Improve handling of gradients

By calling clutter_actor_get_allocation() in st_widget_recompute_style()
to determine whether to redraw gradients, we triggered a complete
reallocation of the stage for each gradient.

As gradients are processed in st_widget_real_style_changed() anyway, the
additional checks in st_widget_recompute_style() are redundant and can
be removed altogether.

https://bugzilla.gnome.org/show_bug.cgi?id=608847
This commit is contained in:
Florian Müllner 2010-02-03 21:30:35 +01:00
parent 2b15f38730
commit fd1ce40ee7

View File

@ -1520,22 +1520,12 @@ static void
st_widget_recompute_style (StWidget *widget, st_widget_recompute_style (StWidget *widget,
StThemeNode *old_theme_node) StThemeNode *old_theme_node)
{ {
ClutterActorBox allocation_box;
StThemeNode *new_theme_node = st_widget_get_theme_node (widget); StThemeNode *new_theme_node = st_widget_get_theme_node (widget);
clutter_actor_get_allocation_box ((ClutterActor *) widget, &allocation_box);
if (!old_theme_node || if (!old_theme_node ||
!st_theme_node_geometry_equal (old_theme_node, new_theme_node)) !st_theme_node_geometry_equal (old_theme_node, new_theme_node))
clutter_actor_queue_relayout ((ClutterActor *) widget); clutter_actor_queue_relayout ((ClutterActor *) widget);
/* Could compare gradient values here if we hit a performance issue.
* Also, only redraw if we've been allocated.
*/
if (allocation_box.x2 - allocation_box.x1 > 0 &&
allocation_box.y2 - allocation_box.y1 > 0)
st_widget_redraw_gradient (widget);
g_signal_emit (widget, signals[STYLE_CHANGED], 0); g_signal_emit (widget, signals[STYLE_CHANGED], 0);
widget->priv->is_style_dirty = FALSE; widget->priv->is_style_dirty = FALSE;
} }