[mutter] clutter/paint-node: Have caller of .._get_framebuffer() handle fallback
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter/paint-node: Have caller of .._get_framebuffer() handle fallback
- Date: Tue, 3 Dec 2019 19:14:33 +0000 (UTC)
commit f11170fecb33da52ab1e9be6c1839f214025f55f
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Fri Nov 22 10:19:09 2019 +0100
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
clutter/clutter/clutter-paint-node.c | 9 +++++----
clutter/clutter/clutter-paint-nodes.c | 18 +++++++++++++++---
src/compositor/meta-shaped-texture.c | 6 +++++-
3 files changed, 25 insertions(+), 8 deletions(-)
---
diff --git a/clutter/clutter/clutter-paint-node.c b/clutter/clutter/clutter-paint-node.c
index efdaef0e6..877ec1784 100644
--- a/clutter/clutter/clutter-paint-node.c
+++ b/clutter/clutter/clutter-paint-node.c
@@ -1203,9 +1203,10 @@ clutter_paint_node_get_root (ClutterPaintNode *node)
* @node: a #ClutterPaintNode
*
* 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 *
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);
if (klass->get_framebuffer != NULL)
return klass->get_framebuffer (root);
-
- return cogl_get_draw_framebuffer ();
+ else
+ return NULL;
}
diff --git a/clutter/clutter/clutter-paint-nodes.c b/clutter/clutter/clutter-paint-nodes.c
index 964ef3ea6..e9282431f 100644
--- a/clutter/clutter/clutter-paint-nodes.c
+++ b/clutter/clutter/clutter-paint-nodes.c
@@ -413,6 +413,18 @@ clutter_pipeline_node_pre_draw (ClutterPaintNode *node,
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
clutter_pipeline_node_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
@@ -818,7 +830,7 @@ clutter_text_node_draw (ClutterPaintNode *node,
if (node->operations == NULL)
return;
- fb = clutter_paint_node_get_framebuffer (node);
+ fb = get_target_framebuffer (node);
pango_layout_get_pixel_extents (tnode->layout, NULL, &extents);
@@ -1004,7 +1016,7 @@ clutter_clip_node_pre_draw (ClutterPaintNode *node,
if (node->operations == NULL)
return FALSE;
- fb = clutter_paint_node_get_framebuffer (node);
+ fb = get_target_framebuffer (node);
for (i = 0; i < node->operations->len; i++)
{
@@ -1048,7 +1060,7 @@ clutter_clip_node_post_draw (ClutterPaintNode *node,
if (node->operations == NULL)
return;
- fb = clutter_paint_node_get_framebuffer (node);
+ fb = get_target_framebuffer (node);
for (i = 0; i < node->operations->len; i++)
{
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
index ec02667ac..7a1a91df5 100644
--- a/src/compositor/meta-shaped-texture.c
+++ b/src/compositor/meta-shaped-texture.c
@@ -525,6 +525,7 @@ do_paint_content (MetaShapedTexture *stex,
cairo_region_t *blended_tex_region;
CoglContext *ctx;
CoglPipelineFilter filter;
+ CoglFramebuffer *framebuffer;
ensure_size_valid (stex);
@@ -547,7 +548,10 @@ do_paint_content (MetaShapedTexture *stex,
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,
NULL, NULL))
filter = COGL_PIPELINE_FILTER_NEAREST;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]