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 <ebassi@linux.intel.com>
This commit is contained in:
Owen W. Taylor 2010-03-26 00:41:46 +00:00 committed by Emmanuele Bassi
parent 8df4a0b8fd
commit 6fcc8c5bce

View File

@ -435,14 +435,18 @@ clutter_x11_texture_pixmap_real_queue_damage_redraw (
* actor coordinates... * actor coordinates...
*/ */
/* XXX: we don't care if we get an out of date allocation here because /* Calling clutter_actor_get_allocation_box() is enormously expensive
* clutter_actor_queue_clipped_redraw knows to ignore the clip if the * if the actor has an out-of-date allocation, since it triggers
* actor's allocation is invalid. * a full redraw. clutter_actor_queue_clipped_redraw() would redraw
* * the whole stage anyways in that case, so just go ahead and do
* This is noted because clutter_actor_get_allocation_box does some * it here.
* unnecessary work to support buggy code with a comment suggesting that
* it could be changed later which would be good for this use case!
*/ */
if (!clutter_actor_has_allocation (self))
{
clutter_actor_queue_redraw (self);
return;
}
clutter_actor_get_allocation_box (self, &allocation); clutter_actor_get_allocation_box (self, &allocation);
g_object_get (self, g_object_get (self,