[actor_paint] Ensure painting is a NOP for actors with opacity = 0

Since it is convenient to use geometry with an opacity of 0 for input only
purposes it's a worthwhile optimization to avoid submitting anything
for such actors while painting.
This commit is contained in:
Robert Bragg 2009-05-20 17:55:29 +01:00
parent f13c3ee309
commit 2c6719502a

View File

@ -1561,6 +1561,13 @@ clutter_actor_paint (ClutterActor *self)
g_return_if_fail (CLUTTER_IS_ACTOR (self)); g_return_if_fail (CLUTTER_IS_ACTOR (self));
priv = self->priv; priv = self->priv;
context = clutter_context_get_default ();
/* It's an important optimization that we consider painting of
* actors with 0 opacity to be a NOP... */
if (G_LIKELY (context->pick_mode == CLUTTER_PICK_NONE) &&
priv->opacity == 0)
return;
if (!CLUTTER_ACTOR_IS_REALIZED (self)) if (!CLUTTER_ACTOR_IS_REALIZED (self))
{ {
@ -1603,7 +1610,6 @@ clutter_actor_paint (ClutterActor *self)
clip_set = TRUE; clip_set = TRUE;
} }
context = clutter_context_get_default ();
if (G_UNLIKELY (context->pick_mode != CLUTTER_PICK_NONE)) if (G_UNLIKELY (context->pick_mode != CLUTTER_PICK_NONE))
{ {
ClutterColor col = { 0, }; ClutterColor col = { 0, };
@ -3436,6 +3442,9 @@ clutter_actor_destroy (ClutterActor *self)
* *
* This function will not do anything if @self is not visible, or * This function will not do anything if @self is not visible, or
* if the actor is inside an invisible part of the scenegraph. * if the actor is inside an invisible part of the scenegraph.
*
* Also be aware that painting is a NOP for actors with an opacity of
* 0
*/ */
void void
clutter_actor_queue_redraw (ClutterActor *self) clutter_actor_queue_redraw (ClutterActor *self)