From: Owen W. Taylor Date: Fri, 26 Mar 2010 00:41:46 +0000 (+0000) Subject: x11: Use has_allocation() in TfP actor X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6fcc8c5bce08296151de418e472d2777c8b2abca;p=profile%2Fivi%2Fclutter.git x11: Use has_allocation() in TfP actor ClutterX11TexturePixmap calls get_allocation_box() when queueing a clipped redraw. If the allocation is not valid, and if we queue a lot of redraws in response to a series of damage events, the net result is that we spend all our time in a re-layout. We can short-circuit this by checking if the actor has a valid allocation, and if not, just queue a redraw - the actor will be allocated by the time it is going to be painted. Signed-off-by: Emmanuele Bassi --- diff --git a/clutter/x11/clutter-x11-texture-pixmap.c b/clutter/x11/clutter-x11-texture-pixmap.c index e290dba..036419a 100644 --- a/clutter/x11/clutter-x11-texture-pixmap.c +++ b/clutter/x11/clutter-x11-texture-pixmap.c @@ -435,14 +435,18 @@ clutter_x11_texture_pixmap_real_queue_damage_redraw ( * actor coordinates... */ - /* XXX: we don't care if we get an out of date allocation here because - * clutter_actor_queue_clipped_redraw knows to ignore the clip if the - * actor's allocation is invalid. - * - * This is noted because clutter_actor_get_allocation_box does some - * unnecessary work to support buggy code with a comment suggesting that - * it could be changed later which would be good for this use case! + /* Calling clutter_actor_get_allocation_box() is enormously expensive + * if the actor has an out-of-date allocation, since it triggers + * a full redraw. clutter_actor_queue_clipped_redraw() would redraw + * the whole stage anyways in that case, so just go ahead and do + * it here. */ + if (!clutter_actor_has_allocation (self)) + { + clutter_actor_queue_redraw (self); + return; + } + clutter_actor_get_allocation_box (self, &allocation); g_object_get (self,