From b63e104561cfe68c958f73c7a17c9cac69689f54 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Tue, 29 Jan 2019 12:46:08 -0200 Subject: [PATCH] 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 bebbc3eb7..4701daab7 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__ */