From dc976922714ab74f37c69a9ea109ad4e145fce92 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Tue, 7 Sep 2010 21:56:33 +0100 Subject: [PATCH] actor: re-allocation implies need to redraw If clutter_actor_allocate finds it necessary to update an actors allocation then it now also queue a redraw of that actor. Currently we queue redraws for actors very early on when queuing a relayout instead of waiting to determine the final outcome of relayouting to determine if a redraw is really required. With this in place we can move away from preemptive queuing of redraws. --- clutter/clutter-actor.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index fcd3af045..f14171cc8 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -5487,6 +5487,7 @@ clutter_actor_allocate (ClutterActor *self, ClutterActorClass *klass; ClutterActorBox alloc; gboolean child_moved; + gboolean stage_allocation_changed; g_return_if_fail (CLUTTER_IS_ACTOR (self)); if (G_UNLIKELY (_clutter_actor_get_stage_internal (self) == NULL)) @@ -5516,6 +5517,14 @@ clutter_actor_allocate (ClutterActor *self, child_moved = (alloc.x1 != priv->allocation.x1 || alloc.y1 != priv->allocation.y1); + if (flags & CLUTTER_ABSOLUTE_ORIGIN_CHANGED || + child_moved || + alloc.x2 != priv->allocation.x2 || + alloc.y2 != priv->allocation.y2) + stage_allocation_changed = TRUE; + else + stage_allocation_changed = FALSE; + /* If we get an allocation "out of the blue" * (we did not queue relayout), then we want to * ignore it. But if we have needs_allocation set, @@ -5529,11 +5538,7 @@ clutter_actor_allocate (ClutterActor *self, * not moved. */ - if (!priv->needs_allocation && - !(flags & CLUTTER_ABSOLUTE_ORIGIN_CHANGED) && - !child_moved && - alloc.x2 == priv->allocation.x2 && - alloc.y2 == priv->allocation.y2) + if (!priv->needs_allocation && !stage_allocation_changed) { CLUTTER_NOTE (LAYOUT, "No allocation needed"); return; @@ -5554,6 +5559,9 @@ clutter_actor_allocate (ClutterActor *self, klass->allocate (self, &alloc, flags); CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_IN_RELAYOUT); + + if (stage_allocation_changed) + clutter_actor_queue_redraw (self); } /**