[mutter/gbsneto/more-clutter-api: 9/10] clutter/paint-nodes: Expose ClutterRootNode



commit cb32ddcfc752d9f1171faac8e51f657cfa832b9a
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Jan 29 12:46:08 2019 -0200

    clutter/paint-nodes: Expose ClutterRootNode
    
    The ClutterRootNode paint node is theoretically the
    top-most node of a paint nodes tree, except that we
    are not in the point of having full rendering trees
    in Clutter (all rendering performed by paint nodes
    is still local and immediate).
    
    When controlling the rendering tree, MetaShapedTexture
    may need to paint into an offscreen framebuffer under
    some circumstations.
    
    Expose ClutterRootNode so that MetaShapedTexture can
    use it to render to offscreen framebuffers.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/405

 clutter/clutter/clutter-actor.c              |  2 +-
 clutter/clutter/clutter-paint-node-private.h |  4 ----
 clutter/clutter/clutter-paint-nodes.c        | 15 ++++++---------
 clutter/clutter/clutter-paint-nodes.h        | 20 ++++++++++++++++++++
 4 files changed, 27 insertions(+), 14 deletions(-)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index f01199519..e66737b0b 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -3740,7 +3740,7 @@ clutter_actor_paint_node (ClutterActor     *actor,
       if (!clutter_stage_get_no_clear_hint (CLUTTER_STAGE (actor)))
         clear_flags |= COGL_BUFFER_BIT_COLOR;
 
-      node = _clutter_root_node_new (fb, &bg_color, clear_flags);
+      node = clutter_root_node_new (fb, &bg_color, clear_flags);
       clutter_paint_node_set_name (node, "stageClear");
       clutter_paint_node_add_rectangle (node, &box);
       clutter_paint_node_add_child (root, node);
diff --git a/clutter/clutter/clutter-paint-node-private.h b/clutter/clutter/clutter-paint-node-private.h
index e6573ecd9..55cf9efd2 100644
--- a/clutter/clutter/clutter-paint-node-private.h
+++ b/clutter/clutter/clutter-paint-node-private.h
@@ -97,7 +97,6 @@ struct _ClutterPaintOperation
   } op;
 };
 
-GType _clutter_root_node_get_type (void) G_GNUC_CONST;
 GType _clutter_transform_node_get_type (void) G_GNUC_CONST;
 GType _clutter_dummy_node_get_type (void) G_GNUC_CONST;
 
@@ -110,9 +109,6 @@ void                    _clutter_paint_operation_paint_primitive        (const C
 void                    _clutter_paint_node_init_types                  (void);
 gpointer                _clutter_paint_node_create                      (GType gtype);
 
-ClutterPaintNode *      _clutter_root_node_new                          (CoglFramebuffer             
*framebuffer,
-                                                                         const ClutterColor          
*clear_color,
-                                                                         CoglBufferBit                
clear_flags);
 ClutterPaintNode *      _clutter_transform_node_new                     (const CoglMatrix            
*matrix);
 ClutterPaintNode *      _clutter_dummy_node_new                         (ClutterActor                *actor);
 
diff --git a/clutter/clutter/clutter-paint-nodes.c b/clutter/clutter/clutter-paint-nodes.c
index 638ddb4a7..74e544b51 100644
--- a/clutter/clutter/clutter-paint-nodes.c
+++ b/clutter/clutter/clutter-paint-nodes.c
@@ -83,16 +83,13 @@ _clutter_paint_node_init_types (void)
 }
 
 /*
- * Root node, private
+ * Root node
  *
  * any frame can only have a since RootNode instance for each
  * top-level actor.
  */
 
-#define clutter_root_node_get_type      _clutter_root_node_get_type
-
-typedef struct _ClutterRootNode         ClutterRootNode;
-typedef struct _ClutterPaintNodeClass   ClutterRootNodeClass;
+#define clutter_root_node_get_type      clutter_root_node_get_type
 
 struct _ClutterRootNode
 {
@@ -158,13 +155,13 @@ clutter_root_node_init (ClutterRootNode *self)
 }
 
 ClutterPaintNode *
-_clutter_root_node_new (CoglFramebuffer    *framebuffer,
-                        const ClutterColor *clear_color,
-                        CoglBufferBit       clear_flags)
+clutter_root_node_new (CoglFramebuffer    *framebuffer,
+                       const ClutterColor *clear_color,
+                       CoglBufferBit       clear_flags)
 {
   ClutterRootNode *res;
 
-  res = _clutter_paint_node_create (_clutter_root_node_get_type ());
+  res = _clutter_paint_node_create (CLUTTER_TYPE_ROOT_NODE);
 
   cogl_color_init_from_4ub (&res->clear_color,
                             clear_color->red,
diff --git a/clutter/clutter/clutter-paint-nodes.h b/clutter/clutter/clutter-paint-nodes.h
index 381c7f8a7..ecaae60ba 100644
--- a/clutter/clutter/clutter-paint-nodes.h
+++ b/clutter/clutter/clutter-paint-nodes.h
@@ -143,6 +143,26 @@ CLUTTER_EXPORT
 ClutterPaintNode *      clutter_text_node_new           (PangoLayout           *layout,
                                                          const ClutterColor    *color);
 
+#define CLUTTER_TYPE_ROOT_NODE                  (clutter_root_node_get_type ())
+#define CLUTTER_ROOT_NODE(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ROOT_NODE, 
ClutterRootNode))
+#define CLUTTER_IS_ROOT_NODE(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ROOT_NODE))
+
+/**
+ * ClutterRootNode:
+ *
+ * The #ClutterRootNode structure is an opaque
+ * type whose members cannot be directly accessed.
+ */
+typedef struct _ClutterRootNode                 ClutterRootNode;
+typedef struct _ClutterPaintNodeClass           ClutterRootNodeClass;
+
+CLUTTER_EXPORT
+GType clutter_root_node_get_type (void) G_GNUC_CONST;
+
+CLUTTER_EXPORT
+ClutterPaintNode *      clutter_root_node_new           (CoglFramebuffer       *framebuffer,
+                                                         const ClutterColor    *clear_color,
+                                                         CoglBufferBit          clear_flags);
 G_END_DECLS
 
 #endif /* __CLUTTER_PAINT_NODES_H__ */


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