[clutter/wip/optimizations-2: 11/13] actor: Clean up ::show and ::hide class handlers



commit 143bf614873124e73b0ac660b3073e2b6dd25dc7
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Fri Mar 8 15:24:50 2013 +0000

    actor: Clean up ::show and ::hide class handlers
    
    The main body of the function should not live inside an 'if' block.

 clutter/clutter-actor.c |   81 ++++++++++++++++++++++++-----------------------
 1 files changed, 41 insertions(+), 40 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 5fbb05f..bcb944b 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -1629,34 +1629,35 @@ clutter_actor_unmap (ClutterActor *self)
 static void
 clutter_actor_real_show (ClutterActor *self)
 {
-  if (!CLUTTER_ACTOR_IS_VISIBLE (self))
-    {
-      ClutterActorPrivate *priv = self->priv;
+  ClutterActorPrivate *priv = self->priv;
 
-      CLUTTER_ACTOR_SET_FLAGS (self, CLUTTER_ACTOR_VISIBLE);
+  if (CLUTTER_ACTOR_IS_VISIBLE (self))
+    return;
 
-      /* we notify on the "visible" flag in the clutter_actor_show()
-       * wrapper so the entire show signal emission completes first
-       * (?)
-       */
-      clutter_actor_update_map_state (self, MAP_STATE_CHECK);
+  CLUTTER_ACTOR_SET_FLAGS (self, CLUTTER_ACTOR_VISIBLE);
 
-      /* we queue a relayout unless the actor is inside a
-       * container that explicitly told us not to
+  /* we notify on the "visible" flag in the clutter_actor_show()
+   * wrapper so the entire show signal emission completes first,
+   * and the branch of the scene graph is in a stable state
+   */
+  clutter_actor_update_map_state (self, MAP_STATE_CHECK);
+
+  /* we queue a relayout unless the actor is inside a
+   * container that explicitly told us not to
+   */
+  if (priv->parent != NULL &&
+      (!(priv->parent->flags & CLUTTER_ACTOR_NO_LAYOUT)))
+    {
+      /* While an actor is hidden the parent may not have
+       * allocated/requested so we need to start from scratch
+       * and avoid the short-circuiting in
+       * clutter_actor_queue_relayout().
        */
-      if (priv->parent != NULL &&
-          (!(priv->parent->flags & CLUTTER_ACTOR_NO_LAYOUT)))
-        {
-          /* While an actor is hidden the parent may not have
-           * allocated/requested so we need to start from scratch
-           * and avoid the short-circuiting in
-           * clutter_actor_queue_relayout().
-           */
-          priv->needs_width_request  = FALSE;
-          priv->needs_height_request = FALSE;
-          priv->needs_allocation     = FALSE;
-          clutter_actor_queue_relayout (self);
-        }
+      priv->needs_width_request  = FALSE;
+      priv->needs_height_request = FALSE;
+      priv->needs_allocation     = FALSE;
+
+      clutter_actor_queue_relayout (self);
     }
 }
 
@@ -1764,25 +1765,25 @@ clutter_actor_show_all (ClutterActor *self)
 static void
 clutter_actor_real_hide (ClutterActor *self)
 {
-  if (CLUTTER_ACTOR_IS_VISIBLE (self))
-    {
-      ClutterActorPrivate *priv = self->priv;
+  ClutterActorPrivate *priv = self->priv;
+
+  if (!CLUTTER_ACTOR_IS_VISIBLE (self))
+    return;
 
-      CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_VISIBLE);
+  CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_VISIBLE);
 
-      /* we notify on the "visible" flag in the clutter_actor_hide()
-       * wrapper so the entire hide signal emission completes first
-       * (?)
-       */
-      clutter_actor_update_map_state (self, MAP_STATE_CHECK);
+  /* we notify on the "visible" flag in the clutter_actor_hide()
+   * wrapper so the entire hide signal emission completes first,
+   * and the branch of the scene graph is in a stable state
+   */
+  clutter_actor_update_map_state (self, MAP_STATE_CHECK);
 
-      /* we queue a relayout unless the actor is inside a
-       * container that explicitly told us not to
-       */
-      if (priv->parent != NULL &&
-          (!(priv->parent->flags & CLUTTER_ACTOR_NO_LAYOUT)))
-        clutter_actor_queue_relayout (priv->parent);
-    }
+  /* we queue a relayout unless the actor is inside a
+   * container that explicitly told us not to
+   */
+  if (priv->parent != NULL &&
+      (!(priv->parent->flags & CLUTTER_ACTOR_NO_LAYOUT)))
+    clutter_actor_queue_relayout (priv->parent);
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]