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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3007>
This commit is contained in:
Georges Basile Stavracas Neto 2020-12-17 20:17:51 -03:00 committed by Marge Bot
parent 894b4c713f
commit 0e8356936c
2 changed files with 16 additions and 26 deletions

View File

@ -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;

View File

@ -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);
}