From 0e8356936c35223ff229739ae5386a6c1168f25f Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Thu, 17 Dec 2020 20:17:51 -0300 Subject: [PATCH] clutter/actor: Move root node to ClutterStage For now, it goes the "easy" way of creating the root node and immediately painting and destroying it. From now on, the main root node is created only by ClutterStage itself. Part-of: --- clutter/clutter/clutter-actor.c | 29 +++-------------------------- clutter/clutter/clutter-stage.c | 13 +++++++++++++ 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c index 61b9fd7c0..050cf9986 100644 --- a/clutter/clutter/clutter-actor.c +++ b/clutter/clutter/clutter-actor.c @@ -3520,32 +3520,9 @@ clutter_actor_paint_node (ClutterActor *actor, bg_color = priv->bg_color; - if (CLUTTER_ACTOR_IS_TOPLEVEL (actor)) - { - ClutterPaintNode *node; - CoglFramebuffer *fb; - CoglBufferBit clear_flags; - - fb = clutter_paint_context_get_base_framebuffer (paint_context); - - bg_color.alpha = 255; - - CLUTTER_NOTE (PAINT, "Stage clear color: (%d, %d, %d, %d)", - bg_color.red, - bg_color.green, - bg_color.blue, - bg_color.alpha); - - clear_flags = COGL_BUFFER_BIT_DEPTH; - - node = clutter_root_node_new (fb, &bg_color, clear_flags); - clutter_paint_node_set_static_name (node, "stageClear"); - clutter_paint_node_add_rectangle (node, &box); - clutter_paint_node_add_child (root, node); - clutter_paint_node_unref (node); - } - else if (priv->bg_color_set && - !clutter_color_equal (&priv->bg_color, CLUTTER_COLOR_Transparent)) + if (!CLUTTER_ACTOR_IS_TOPLEVEL (actor) && + priv->bg_color_set && + !clutter_color_equal (&priv->bg_color, CLUTTER_COLOR_Transparent)) { ClutterPaintNode *node; diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c index 4afb5b705..f17f331f1 100644 --- a/clutter/clutter/clutter-stage.c +++ b/clutter/clutter/clutter-stage.c @@ -412,6 +412,9 @@ clutter_stage_do_paint_view (ClutterStage *stage, cairo_rectangle_int_t clip_rect; g_autoptr (GArray) clip_frusta = NULL; graphene_frustum_t clip_frustum; + ClutterPaintNode *root_node; + CoglFramebuffer *fb; + ClutterColor bg_color; int n_rectangles; n_rectangles = redraw_clip ? cairo_region_num_rectangles (redraw_clip) : 0; @@ -454,6 +457,16 @@ clutter_stage_do_paint_view (ClutterStage *stage, if (frame) clutter_paint_context_assign_frame (paint_context, frame); + clutter_actor_get_background_color (CLUTTER_ACTOR (stage), &bg_color); + bg_color.alpha = 255; + + fb = clutter_stage_view_get_framebuffer (view); + + root_node = clutter_root_node_new (fb, &bg_color, COGL_BUFFER_BIT_DEPTH); + clutter_paint_node_set_static_name (root_node, "Stage (root)"); + clutter_paint_node_paint (root_node, paint_context); + clutter_paint_node_unref (root_node); + clutter_actor_paint (CLUTTER_ACTOR (stage), paint_context); clutter_paint_context_destroy (paint_context); }