[mutter] clutter: Use paint context to get paint target framebuffer



commit 78a7c938029667767c86d2259ea64857ecf9d4dd
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Thu Nov 21 21:31:29 2019 +0100

    clutter: Use paint context to get paint target framebuffer
    
    Instead of using the intermediate stage state "active framebuffer" to
    find the framebuffer a paint eventually targets, use the "base
    framebuffer" of the paint context, as this more correctly corresponds to
    the end point of a paint. It also means we can then later remove this
    intermediate state from the stage.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/935

 clutter/clutter/clutter-actor.c              |  6 ++++--
 clutter/clutter/clutter-paint-node-private.h |  3 ++-
 clutter/clutter/clutter-paint-nodes.c        | 16 ++++++++++++++--
 3 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index 3e9bf8e0b..39b664e94 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -3817,7 +3817,7 @@ clutter_actor_paint_node (ClutterActor        *actor,
       CoglFramebuffer *fb;
       CoglBufferBit clear_flags;
 
-      fb = _clutter_stage_get_active_framebuffer (CLUTTER_STAGE (actor));
+      fb = clutter_paint_context_get_base_framebuffer (paint_context);
 
       if (clutter_stage_get_use_alpha (CLUTTER_STAGE (actor)))
         {
@@ -4123,6 +4123,7 @@ clutter_actor_continue_paint (ClutterActor        *self,
      actual actor */
   if (priv->next_effect_to_paint == NULL)
     {
+      CoglFramebuffer *framebuffer;
       ClutterPaintNode *dummy;
 
       /* XXX - this will go away in 2.0, when we can get rid of this
@@ -4130,7 +4131,8 @@ clutter_actor_continue_paint (ClutterActor        *self,
        * for the entire frame, starting from the Stage; the paint()
        * virtual function can then be called directly.
        */
-      dummy = _clutter_dummy_node_new (self);
+      framebuffer = clutter_paint_context_get_base_framebuffer (paint_context);
+      dummy = _clutter_dummy_node_new (self, framebuffer);
       clutter_paint_node_set_name (dummy, "Root");
 
       /* XXX - for 1.12, we use the return value of paint_node() to
diff --git a/clutter/clutter/clutter-paint-node-private.h b/clutter/clutter/clutter-paint-node-private.h
index 8d81ad184..2c5f1deae 100644
--- a/clutter/clutter/clutter-paint-node-private.h
+++ b/clutter/clutter/clutter-paint-node-private.h
@@ -115,7 +115,8 @@ void                    _clutter_paint_node_init_types                  (void);
 gpointer                _clutter_paint_node_create                      (GType gtype);
 
 ClutterPaintNode *      _clutter_transform_node_new                     (const CoglMatrix            
*matrix);
-ClutterPaintNode *      _clutter_dummy_node_new                         (ClutterActor                *actor);
+ClutterPaintNode *      _clutter_dummy_node_new                         (ClutterActor                *actor,
+                                                                         CoglFramebuffer             
*framebuffer);
 
 void                    _clutter_paint_node_dump_tree                   (ClutterPaintNode            *root);
 
diff --git a/clutter/clutter/clutter-paint-nodes.c b/clutter/clutter/clutter-paint-nodes.c
index 7e47e7416..a0692e6b6 100644
--- a/clutter/clutter/clutter-paint-nodes.c
+++ b/clutter/clutter/clutter-paint-nodes.c
@@ -320,6 +320,16 @@ clutter_dummy_node_get_framebuffer (ClutterPaintNode *node)
   return dnode->framebuffer;
 }
 
+static void
+clutter_dummy_node_finalize (ClutterPaintNode *node)
+{
+  ClutterDummyNode *dnode = (ClutterDummyNode *) node;
+
+  cogl_clear_object (&dnode->framebuffer);
+
+  CLUTTER_PAINT_NODE_CLASS (clutter_dummy_node_parent_class)->finalize (node);
+}
+
 static void
 clutter_dummy_node_class_init (ClutterDummyNodeClass *klass)
 {
@@ -328,6 +338,7 @@ clutter_dummy_node_class_init (ClutterDummyNodeClass *klass)
   node_class->pre_draw = clutter_dummy_node_pre_draw;
   node_class->serialize = clutter_dummy_node_serialize;
   node_class->get_framebuffer = clutter_dummy_node_get_framebuffer;
+  node_class->finalize = clutter_dummy_node_finalize;
 }
 
 static void
@@ -336,7 +347,8 @@ clutter_dummy_node_init (ClutterDummyNode *self)
 }
 
 ClutterPaintNode *
-_clutter_dummy_node_new (ClutterActor *actor)
+_clutter_dummy_node_new (ClutterActor    *actor,
+                         CoglFramebuffer *framebuffer)
 {
   ClutterPaintNode *res;
   ClutterDummyNode *dnode;
@@ -345,7 +357,7 @@ _clutter_dummy_node_new (ClutterActor *actor)
 
   dnode = (ClutterDummyNode *) res;
   dnode->actor = actor;
-  dnode->framebuffer = _clutter_actor_get_active_framebuffer (actor);
+  dnode->framebuffer = cogl_object_ref (framebuffer);
 
   return res;
 }


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