[mutter/gbsneto/actor-node-improvements: 1/3] clutter/actor: Move paint flag to ClutterActorNode



commit e302edefba9243387f39b0ec14ad5c9059d686fd
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Oct 25 09:32:57 2019 -0300

    clutter/actor: Move paint flag to ClutterActorNode
    
    Now that we unconditionally use ClutterActorNode to
    paint ClutterActors, move the PAINT private flag to
    the ClutterActorNode. This way, we can run the paint
    on the actor anywhere inside the paint tree.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/890

 clutter/clutter/clutter-actor.c       |  9 +--------
 clutter/clutter/clutter-paint-nodes.c | 13 +++++++++++++
 2 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index ac2e54afd..bf661056f 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -3906,9 +3906,6 @@ clutter_actor_paint (ClutterActor *self)
 
   clutter_actor_ensure_resource_scale (self);
 
-  /* mark that we are in the paint process */
-  CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_PAINT);
-
   actor_node = clutter_actor_node_new (self);
   root_node = clutter_paint_node_ref (actor_node);
 
@@ -4044,7 +4041,7 @@ clutter_actor_paint (ClutterActor *self)
       if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS))
         _clutter_actor_paint_cull_result (self, success, result);
       else if (result == CLUTTER_CULL_RESULT_OUT && success)
-        goto done;
+        return;
     }
 
   if (priv->effects == NULL)
@@ -4061,10 +4058,6 @@ clutter_actor_paint (ClutterActor *self)
   /* If we make it here then the actor has run through a complete
      paint run including all the effects so it's no longer dirty */
   priv->is_dirty = FALSE;
-
-done:
-  /* paint sequence complete */
-  CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_IN_PAINT);
 }
 
 /**
diff --git a/clutter/clutter/clutter-paint-nodes.c b/clutter/clutter/clutter-paint-nodes.c
index 94aa24fd9..4c5b23ba5 100644
--- a/clutter/clutter/clutter-paint-nodes.c
+++ b/clutter/clutter/clutter-paint-nodes.c
@@ -1102,6 +1102,10 @@ G_DEFINE_TYPE (ClutterActorNode, clutter_actor_node, CLUTTER_TYPE_PAINT_NODE)
 static gboolean
 clutter_actor_node_pre_draw (ClutterPaintNode *node)
 {
+  ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
+
+  CLUTTER_SET_PRIVATE_FLAGS (actor_node->actor, CLUTTER_IN_PAINT);
+
   return TRUE;
 }
 
@@ -1113,6 +1117,14 @@ clutter_actor_node_draw (ClutterPaintNode *node)
   clutter_actor_continue_paint (actor_node->actor);
 }
 
+static void
+clutter_actor_node_post_draw (ClutterPaintNode *node)
+{
+  ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
+
+  CLUTTER_UNSET_PRIVATE_FLAGS (actor_node->actor, CLUTTER_IN_PAINT);
+}
+
 static JsonNode *
 clutter_actor_node_serialize (ClutterPaintNode *node)
 {
@@ -1139,6 +1151,7 @@ clutter_actor_node_class_init (ClutterActorNodeClass *klass)
   node_class = CLUTTER_PAINT_NODE_CLASS (klass);
   node_class->pre_draw = clutter_actor_node_pre_draw;
   node_class->draw = clutter_actor_node_draw;
+  node_class->post_draw = clutter_actor_node_post_draw;
   node_class->serialize = clutter_actor_node_serialize;
 }
 


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