never presume queuing redraws on invisible actors is redundant

This replaces code like this:
  if (CLUTTER_ACTOR_IS_VISIBLE (self))
    clutter_actor_queue_redraw (self);
with:
  clutter_actor_queue_redraw (self);

clutter_actor_queue_redraw internally knows what can be optimized when
the actor is not visible, but it also knows that the queue_redraw signal
must always be sent in case a ClutterClone is cloning a hidden actor.
This commit is contained in:
Robert Bragg 2010-02-09 19:34:32 +00:00
parent bfb271b403
commit b898f0e227
6 changed files with 27 additions and 52 deletions

View File

@ -2499,8 +2499,7 @@ clutter_actor_set_rotation_internal (ClutterActor *self,
g_object_thaw_notify (G_OBJECT (self));
g_object_unref (self);
if (CLUTTER_ACTOR_IS_VISIBLE (self))
clutter_actor_queue_redraw (self);
clutter_actor_queue_redraw (self);
}
static void
@ -6077,8 +6076,7 @@ clutter_actor_set_scale (ClutterActor *self,
priv->scale_y = scale_y;
g_object_notify (G_OBJECT (self), "scale-y");
if (CLUTTER_ACTOR_IS_VISIBLE (self))
clutter_actor_queue_redraw (self);
clutter_actor_queue_redraw (self);
g_object_thaw_notify (G_OBJECT (self));
}
@ -7362,7 +7360,7 @@ clutter_actor_set_anchor_point (ClutterActor *self,
clutter_anchor_coord_set_units (&priv->anchor, anchor_x, anchor_y, 0);
if (changed && CLUTTER_ACTOR_IS_VISIBLE (self))
if (changed)
clutter_actor_queue_redraw (self);
g_object_thaw_notify (G_OBJECT (self));
@ -8792,8 +8790,7 @@ clutter_actor_set_shader_param (ClutterActor *self,
g_value_copy (value, var);
g_hash_table_insert (shader_data->value_hash, g_strdup (param), var);
if (CLUTTER_ACTOR_IS_VISIBLE (self))
clutter_actor_queue_redraw (self);
clutter_actor_queue_redraw (self);
}
/**

View File

@ -147,8 +147,7 @@ clutter_group_real_remove (ClutterContainer *container,
*/
g_signal_emit_by_name (container, "actor-removed", actor);
if (CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR (container)))
clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
g_object_unref (actor);
}
@ -207,8 +206,7 @@ clutter_group_real_raise (ClutterContainer *container,
clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling));
}
if (CLUTTER_ACTOR_IS_VISIBLE (container))
clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
}
static void
@ -247,8 +245,7 @@ clutter_group_real_lower (ClutterContainer *container,
clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling));
}
if (CLUTTER_ACTOR_IS_VISIBLE (container))
clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
}
static void
@ -258,8 +255,7 @@ clutter_group_real_sort_depth_order (ClutterContainer *container)
priv->children = g_list_sort (priv->children, sort_by_depth);
if (CLUTTER_ACTOR_IS_VISIBLE (container))
clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
}
static void

View File

@ -403,8 +403,7 @@ clutter_rectangle_set_color (ClutterRectangle *rectangle,
priv->has_border = TRUE;
#endif
if (CLUTTER_ACTOR_IS_VISIBLE (rectangle))
clutter_actor_queue_redraw (CLUTTER_ACTOR (rectangle));
clutter_actor_queue_redraw (CLUTTER_ACTOR (rectangle));
g_object_notify (G_OBJECT (rectangle), "color");
g_object_notify (G_OBJECT (rectangle), "has-border");
@ -459,8 +458,7 @@ clutter_rectangle_set_border_width (ClutterRectangle *rectangle,
else
priv->has_border = FALSE;
if (CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR (rectangle)))
clutter_actor_queue_redraw (CLUTTER_ACTOR (rectangle));
clutter_actor_queue_redraw (CLUTTER_ACTOR (rectangle));
g_object_notify (G_OBJECT (rectangle), "border-width");
g_object_notify (G_OBJECT (rectangle), "has-border");
@ -530,8 +528,7 @@ clutter_rectangle_set_border_color (ClutterRectangle *rectangle,
else
priv->has_border = TRUE;
if (CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR (rectangle)))
clutter_actor_queue_redraw (CLUTTER_ACTOR (rectangle));
clutter_actor_queue_redraw (CLUTTER_ACTOR (rectangle));
g_object_notify (G_OBJECT (rectangle), "border-color");
g_object_notify (G_OBJECT (rectangle), "has-border");

View File

@ -1253,8 +1253,7 @@ clutter_stage_set_color (ClutterStage *stage,
priv->color = *color;
if (CLUTTER_ACTOR_IS_VISIBLE (stage))
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
g_object_notify (G_OBJECT (stage), "color");
}
@ -1880,8 +1879,7 @@ clutter_stage_set_use_fog (ClutterStage *stage,
CLUTTER_NOTE (MISC, "%s depth-cueing inside stage",
priv->use_fog ? "enabling" : "disabling");
if (CLUTTER_ACTOR_IS_VISIBLE (stage))
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
g_object_notify (G_OBJECT (stage), "use-fog");
}
@ -1958,7 +1956,7 @@ clutter_stage_set_fog (ClutterStage *stage,
priv->fog = *fog;
if (priv->use_fog && CLUTTER_ACTOR_IS_VISIBLE (stage))
if (priv->use_fog)
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
}

View File

@ -3097,8 +3097,7 @@ clutter_text_set_editable (ClutterText *self,
{
priv->editable = editable;
if (CLUTTER_ACTOR_IS_VISIBLE (self))
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
g_object_notify (G_OBJECT (self), "editable");
}
@ -3148,8 +3147,7 @@ clutter_text_set_selectable (ClutterText *self,
{
priv->selectable = selectable;
if (CLUTTER_ACTOR_IS_VISIBLE (self))
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
g_object_notify (G_OBJECT (self), "selectable");
}
@ -3203,8 +3201,7 @@ clutter_text_set_activatable (ClutterText *self,
{
priv->activatable = activatable;
if (CLUTTER_ACTOR_IS_VISIBLE (self))
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
g_object_notify (G_OBJECT (self), "activatable");
}
@ -3295,8 +3292,7 @@ clutter_text_set_cursor_visible (ClutterText *self,
{
priv->cursor_visible = cursor_visible;
if (CLUTTER_ACTOR_IS_VISIBLE (self))
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
g_object_notify (G_OBJECT (self), "cursor-visible");
}
@ -3350,8 +3346,7 @@ clutter_text_set_cursor_color (ClutterText *self,
else
priv->cursor_color_set = FALSE;
if (CLUTTER_ACTOR_IS_VISIBLE (self))
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
g_object_notify (G_OBJECT (self), "cursor-color");
g_object_notify (G_OBJECT (self), "cursor-color-set");
@ -3493,8 +3488,7 @@ clutter_text_set_selection_bound (ClutterText *self,
else
priv->selection_bound = selection_bound;
if (CLUTTER_ACTOR_IS_VISIBLE (self))
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
g_object_notify (G_OBJECT (self), "selection-bound");
}
@ -3550,8 +3544,7 @@ clutter_text_set_selection_color (ClutterText *self,
else
priv->selection_color_set = FALSE;
if (CLUTTER_ACTOR_IS_VISIBLE (self))
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
g_object_notify (G_OBJECT (self), "selection-color");
g_object_notify (G_OBJECT (self), "selection-color-set");
@ -3895,8 +3888,7 @@ clutter_text_set_color (ClutterText *self,
priv->text_color = *color;
if (CLUTTER_ACTOR_IS_VISIBLE (self))
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
g_object_notify (G_OBJECT (self), "color");
}
@ -4355,8 +4347,7 @@ clutter_text_set_cursor_position (ClutterText *self,
time the cursor is moved up or down */
priv->x_pos = -1;
if (CLUTTER_ACTOR_IS_VISIBLE (self))
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
g_object_notify (G_OBJECT (self), "position");
}
@ -4390,8 +4381,7 @@ clutter_text_set_cursor_size (ClutterText *self,
priv->cursor_size = size;
if (CLUTTER_ACTOR_IS_VISIBLE (self))
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
g_object_notify (G_OBJECT (self), "cursor-size");
}

View File

@ -1285,8 +1285,7 @@ clutter_texture_set_cogl_texture (ClutterTexture *texture,
g_object_notify (G_OBJECT (texture), "cogl-texture");
/* If resized actor may need resizing but paint() will do this */
if (CLUTTER_ACTOR_IS_VISIBLE (texture))
clutter_actor_queue_redraw (CLUTTER_ACTOR (texture));
clutter_actor_queue_redraw (CLUTTER_ACTOR (texture));
}
static gboolean
@ -1882,8 +1881,7 @@ clutter_texture_set_filter_quality (ClutterTexture *texture,
g_object_notify (G_OBJECT (texture), "filter-quality");
if (CLUTTER_ACTOR_IS_VISIBLE (texture))
clutter_actor_queue_redraw (CLUTTER_ACTOR (texture));
clutter_actor_queue_redraw (CLUTTER_ACTOR (texture));
}
}
@ -2124,8 +2122,7 @@ clutter_texture_set_area_from_rgb_data (ClutterTexture *texture,
/* rename signal */
g_signal_emit (texture, texture_signals[PIXBUF_CHANGE], 0);
if (CLUTTER_ACTOR_IS_VISIBLE (texture))
clutter_actor_queue_redraw (CLUTTER_ACTOR (texture));
clutter_actor_queue_redraw (CLUTTER_ACTOR (texture));
return TRUE;
}