[mutter/gbsneto/effects-paint-nodes: 10/11] clutter/paint-nodes: Add serialization to layer node




commit 4c75389baa3ff0c2c48c73f3dfa619b4d9eb43f0
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Jun 29 15:26:15 2020 -0300

    clutter/paint-nodes: Add serialization to layer node
    
    It's useful to know which framebuffer the layer node is holding,
    so serialize that too.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1340>

 clutter/clutter/clutter-paint-nodes.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
---
diff --git a/clutter/clutter/clutter-paint-nodes.c b/clutter/clutter/clutter-paint-nodes.c
index 652141c4b5..5c3f76b2fc 100644
--- a/clutter/clutter/clutter-paint-nodes.c
+++ b/clutter/clutter/clutter-paint-nodes.c
@@ -1473,6 +1473,25 @@ clutter_layer_node_finalize (ClutterPaintNode *node)
   CLUTTER_PAINT_NODE_CLASS (clutter_layer_node_parent_class)->finalize (node);
 }
 
+static JsonNode *
+clutter_layer_node_serialize (ClutterPaintNode *node)
+{
+  ClutterLayerNode *layer_node = CLUTTER_LAYER_NODE (node);
+  g_autoptr (JsonBuilder) builder = NULL;
+  g_autofree char *framebuffer_ptr = NULL;
+
+  builder = json_builder_new ();
+
+  framebuffer_ptr = g_strdup_printf ("%p", layer_node->offscreen);
+
+  json_builder_begin_object (builder);
+  json_builder_set_member_name (builder, "framebuffer");
+  json_builder_add_string_value (builder, framebuffer_ptr);
+  json_builder_end_object (builder);
+
+  return json_builder_get_root (builder);
+}
+
 static void
 clutter_layer_node_class_init (ClutterLayerNodeClass *klass)
 {
@@ -1482,6 +1501,7 @@ clutter_layer_node_class_init (ClutterLayerNodeClass *klass)
   node_class->pre_draw = clutter_layer_node_pre_draw;
   node_class->post_draw = clutter_layer_node_post_draw;
   node_class->finalize = clutter_layer_node_finalize;
+  node_class->serialize = clutter_layer_node_serialize;
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]