[mutter/gbsneto/effects-paint-nodes: 94/105] clutter/paint-node: Walk up paint node tree to find framebuffer
- From: Robert Mader <rmader src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/effects-paint-nodes: 94/105] clutter/paint-node: Walk up paint node tree to find framebuffer
- Date: Fri, 14 Aug 2020 16:04:19 +0000 (UTC)
commit a510339970c53b4f718468452644f19cc75f9a84
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Jul 8 14:06:11 2020 -0300
clutter/paint-node: Walk up paint node tree to find framebuffer
The idea of having a paint node tree is that we don't really need
to retrieve the framebuffer from ClutterPaintContext. For example,
ClutterLayerNode draws into an offscreen framebuffer; if any child
of a layer node needs to retrieve a framebuffer to draw, the layer
node's offscreen framebuffer should be used.
However, clutter_paint_node_get_framebuffer() goes straight to the
root node of the tree, skipping any potential paint nodes with a
custom framebuffer.
Modify clutter_paint_node_get_framebuffer() to walk up the paint
node tree until a node with a custom framebuffer appears. In many
cases, this will end up either in dummy or layer node's custom
framebuffer implementations.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1340
clutter/clutter/clutter-paint-node.c | 35 ++++++++++++++++-------------------
1 file changed, 16 insertions(+), 19 deletions(-)
---
diff --git a/clutter/clutter/clutter-paint-node.c b/clutter/clutter/clutter-paint-node.c
index c91182bd06..64d5c43f07 100644
--- a/clutter/clutter/clutter-paint-node.c
+++ b/clutter/clutter/clutter-paint-node.c
@@ -1149,24 +1149,14 @@ _clutter_paint_node_create (GType gtype)
return (gpointer) g_type_create_instance (gtype);
}
-static ClutterPaintNode *
-clutter_paint_node_get_root (ClutterPaintNode *node)
-{
- ClutterPaintNode *iter;
-
- iter = node;
- while (iter != NULL && iter->parent != NULL)
- iter = iter->parent;
-
- return iter;
-}
-
/**
* clutter_paint_node_get_framebuffer:
* @node: a #ClutterPaintNode
*
* Retrieves the #CoglFramebuffer that @node will draw
- * into, if it the root node has a custom framebuffer set.
+ * into. If @node doesn't specify a custom framebuffer,
+ * the first parent node with a custom framebuffer will
+ * be used.
*
* Returns: (transfer none): a #CoglFramebuffer or %NULL if no custom one is
* set.
@@ -1174,12 +1164,19 @@ clutter_paint_node_get_root (ClutterPaintNode *node)
CoglFramebuffer *
clutter_paint_node_get_framebuffer (ClutterPaintNode *node)
{
- ClutterPaintNode *root = clutter_paint_node_get_root (node);
ClutterPaintNodeClass *klass;
+ ClutterPaintNode *iter;
- klass = CLUTTER_PAINT_NODE_GET_CLASS (root);
- if (klass->get_framebuffer != NULL)
- return klass->get_framebuffer (root);
- else
- return NULL;
+ iter = node;
+ while (iter != NULL && iter->parent != NULL)
+ {
+ klass = CLUTTER_PAINT_NODE_GET_CLASS (iter);
+
+ if (klass->get_framebuffer != NULL)
+ return klass->get_framebuffer (iter);
+
+ iter = iter->parent;
+ }
+
+ return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]