clutter/paint-node: Have caller of .._get_framebuffer() handle fallback

clutter_paint_node_get_framebuffer() fell back on
cogl_get_draw_framebuffer() when the root node didn't have a custom
get_framebuffer vfunc. As this relies on deprecated implicit Cogl stack
API, it needs to go away, so handle this in the caller that knows more
about the context.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
This commit is contained in:
Jonas Ådahl 2019-11-22 10:19:09 +01:00 committed by Georges Basile Stavracas Neto
parent 48e6fccc95
commit f11170fecb
3 changed files with 25 additions and 8 deletions

View File

@ -1203,9 +1203,10 @@ clutter_paint_node_get_root (ClutterPaintNode *node)
* @node: a #ClutterPaintNode * @node: a #ClutterPaintNode
* *
* Retrieves the #CoglFramebuffer that @node will draw * Retrieves the #CoglFramebuffer that @node will draw
* into. * into, if it the root node has a custom framebuffer set.
* *
* Returns: (transfer none): a #CoglFramebuffer * Returns: (transfer none): a #CoglFramebuffer or %NULL if no custom one is
* set.
*/ */
CoglFramebuffer * CoglFramebuffer *
clutter_paint_node_get_framebuffer (ClutterPaintNode *node) clutter_paint_node_get_framebuffer (ClutterPaintNode *node)
@ -1216,6 +1217,6 @@ clutter_paint_node_get_framebuffer (ClutterPaintNode *node)
klass = CLUTTER_PAINT_NODE_GET_CLASS (root); klass = CLUTTER_PAINT_NODE_GET_CLASS (root);
if (klass->get_framebuffer != NULL) if (klass->get_framebuffer != NULL)
return klass->get_framebuffer (root); return klass->get_framebuffer (root);
else
return cogl_get_draw_framebuffer (); return NULL;
} }

View File

@ -413,6 +413,18 @@ clutter_pipeline_node_pre_draw (ClutterPaintNode *node,
return FALSE; return FALSE;
} }
static CoglFramebuffer *
get_target_framebuffer (ClutterPaintNode *node)
{
CoglFramebuffer *framebuffer;
framebuffer = clutter_paint_node_get_framebuffer (node);
if (framebuffer)
return framebuffer;
return cogl_get_draw_framebuffer ();
}
static void static void
clutter_pipeline_node_draw (ClutterPaintNode *node, clutter_pipeline_node_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context) ClutterPaintContext *paint_context)
@ -818,7 +830,7 @@ clutter_text_node_draw (ClutterPaintNode *node,
if (node->operations == NULL) if (node->operations == NULL)
return; return;
fb = clutter_paint_node_get_framebuffer (node); fb = get_target_framebuffer (node);
pango_layout_get_pixel_extents (tnode->layout, NULL, &extents); pango_layout_get_pixel_extents (tnode->layout, NULL, &extents);
@ -1004,7 +1016,7 @@ clutter_clip_node_pre_draw (ClutterPaintNode *node,
if (node->operations == NULL) if (node->operations == NULL)
return FALSE; return FALSE;
fb = clutter_paint_node_get_framebuffer (node); fb = get_target_framebuffer (node);
for (i = 0; i < node->operations->len; i++) for (i = 0; i < node->operations->len; i++)
{ {
@ -1048,7 +1060,7 @@ clutter_clip_node_post_draw (ClutterPaintNode *node,
if (node->operations == NULL) if (node->operations == NULL)
return; return;
fb = clutter_paint_node_get_framebuffer (node); fb = get_target_framebuffer (node);
for (i = 0; i < node->operations->len; i++) for (i = 0; i < node->operations->len; i++)
{ {

View File

@ -525,6 +525,7 @@ do_paint_content (MetaShapedTexture *stex,
cairo_region_t *blended_tex_region; cairo_region_t *blended_tex_region;
CoglContext *ctx; CoglContext *ctx;
CoglPipelineFilter filter; CoglPipelineFilter filter;
CoglFramebuffer *framebuffer;
ensure_size_valid (stex); ensure_size_valid (stex);
@ -547,7 +548,10 @@ do_paint_content (MetaShapedTexture *stex,
filter = COGL_PIPELINE_FILTER_LINEAR; filter = COGL_PIPELINE_FILTER_LINEAR;
if (meta_actor_painting_untransformed (clutter_paint_node_get_framebuffer (root_node), framebuffer = clutter_paint_node_get_framebuffer (root_node);
if (!framebuffer)
framebuffer = cogl_get_draw_framebuffer ();
if (meta_actor_painting_untransformed (framebuffer,
dst_width, dst_height, dst_width, dst_height,
NULL, NULL)) NULL, NULL))
filter = COGL_PIPELINE_FILTER_NEAREST; filter = COGL_PIPELINE_FILTER_NEAREST;