Avoid needlessly queue redraws for invisible actors

If an actor is not set as visible, or if it is in a section of
the scenegraph that it's set as not visible (e.g. one of the
parents is not visible) then we should not queue a redraw for
it.

Patch based on code from Michael Boccara <michael@graphtech.co.il>
This commit is contained in:
Emmanuele Bassi 2009-01-22 13:58:50 +00:00
parent c998462c9f
commit a74369e309

View File

@ -3082,6 +3082,9 @@ clutter_actor_destroy (ClutterActor *self)
* *
* Applications rarely need to call this, as redraws are handled * Applications rarely need to call this, as redraws are handled
* automatically by modification functions. * automatically by modification functions.
*
* This function will not do anything if @self is not visible, or
* if the actor is inside an invisible part of the scenegraph.
*/ */
void void
clutter_actor_queue_redraw (ClutterActor *self) clutter_actor_queue_redraw (ClutterActor *self)
@ -3090,7 +3093,16 @@ clutter_actor_queue_redraw (ClutterActor *self)
g_return_if_fail (CLUTTER_IS_ACTOR (self)); g_return_if_fail (CLUTTER_IS_ACTOR (self));
/* FIXME: should we check we're visible here? */ /* short-circuit the trivial case */
if (!CLUTTER_ACTOR_IS_VISIBLE (self))
return;
/* check if any part of the scenegraph we're in
* is not visible
*/
if (!clutter_actor_get_paint_visibility (self))
return;
if ((stage = clutter_actor_get_stage (self)) != NULL) if ((stage = clutter_actor_get_stage (self)) != NULL)
clutter_stage_queue_redraw (CLUTTER_STAGE (stage)); clutter_stage_queue_redraw (CLUTTER_STAGE (stage));
} }