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
This commit is contained in:
Jonas Ådahl 2019-11-21 21:31:29 +01:00 committed by Georges Basile Stavracas Neto
parent 5c68596744
commit 78a7c93802
3 changed files with 20 additions and 5 deletions

View File

@ -3817,7 +3817,7 @@ clutter_actor_paint_node (ClutterActor *actor,
CoglFramebuffer *fb; CoglFramebuffer *fb;
CoglBufferBit clear_flags; 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))) if (clutter_stage_get_use_alpha (CLUTTER_STAGE (actor)))
{ {
@ -4123,6 +4123,7 @@ clutter_actor_continue_paint (ClutterActor *self,
actual actor */ actual actor */
if (priv->next_effect_to_paint == NULL) if (priv->next_effect_to_paint == NULL)
{ {
CoglFramebuffer *framebuffer;
ClutterPaintNode *dummy; ClutterPaintNode *dummy;
/* XXX - this will go away in 2.0, when we can get rid of this /* 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() * for the entire frame, starting from the Stage; the paint()
* virtual function can then be called directly. * 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"); clutter_paint_node_set_name (dummy, "Root");
/* XXX - for 1.12, we use the return value of paint_node() to /* XXX - for 1.12, we use the return value of paint_node() to

View File

@ -115,7 +115,8 @@ void _clutter_paint_node_init_types (void);
gpointer _clutter_paint_node_create (GType gtype); gpointer _clutter_paint_node_create (GType gtype);
ClutterPaintNode * _clutter_transform_node_new (const CoglMatrix *matrix); 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); void _clutter_paint_node_dump_tree (ClutterPaintNode *root);

View File

@ -320,6 +320,16 @@ clutter_dummy_node_get_framebuffer (ClutterPaintNode *node)
return dnode->framebuffer; 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 static void
clutter_dummy_node_class_init (ClutterDummyNodeClass *klass) 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->pre_draw = clutter_dummy_node_pre_draw;
node_class->serialize = clutter_dummy_node_serialize; node_class->serialize = clutter_dummy_node_serialize;
node_class->get_framebuffer = clutter_dummy_node_get_framebuffer; node_class->get_framebuffer = clutter_dummy_node_get_framebuffer;
node_class->finalize = clutter_dummy_node_finalize;
} }
static void static void
@ -336,7 +347,8 @@ clutter_dummy_node_init (ClutterDummyNode *self)
} }
ClutterPaintNode * ClutterPaintNode *
_clutter_dummy_node_new (ClutterActor *actor) _clutter_dummy_node_new (ClutterActor *actor,
CoglFramebuffer *framebuffer)
{ {
ClutterPaintNode *res; ClutterPaintNode *res;
ClutterDummyNode *dnode; ClutterDummyNode *dnode;
@ -345,7 +357,7 @@ _clutter_dummy_node_new (ClutterActor *actor)
dnode = (ClutterDummyNode *) res; dnode = (ClutterDummyNode *) res;
dnode->actor = actor; dnode->actor = actor;
dnode->framebuffer = _clutter_actor_get_active_framebuffer (actor); dnode->framebuffer = cogl_object_ref (framebuffer);
return res; return res;
} }