|
|
32cb41 |
From df565fcb681a50aac5046981c5aba04073d14856 Mon Sep 17 00:00:00 2001
|
|
|
32cb41 |
From: Christian Hergert <christian@hergert.me>
|
|
|
32cb41 |
Date: Fri, 21 Feb 2020 22:36:31 +0000
|
|
|
32cb41 |
Subject: [PATCH 3/3] clutter: fix hole in ClutterPaintNode
|
|
|
32cb41 |
|
|
|
32cb41 |
Fixing the missalignment takes the structure from 80 bytes down to 72.
|
|
|
32cb41 |
|
|
|
32cb41 |
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1081
|
|
|
32cb41 |
---
|
|
|
32cb41 |
clutter/clutter/clutter-actor.c | 8 +++----
|
|
|
32cb41 |
clutter/clutter/clutter-canvas.c | 2 +-
|
|
|
32cb41 |
clutter/clutter/clutter-image.c | 2 +-
|
|
|
32cb41 |
clutter/clutter/clutter-paint-node-private.h | 6 ++---
|
|
|
32cb41 |
clutter/clutter/clutter-paint-node.c | 23 +++++++++++++++-----
|
|
|
32cb41 |
clutter/clutter/clutter-paint-node.h | 3 +++
|
|
|
32cb41 |
6 files changed, 30 insertions(+), 14 deletions(-)
|
|
|
32cb41 |
|
|
|
32cb41 |
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
|
|
|
32cb41 |
index 93d0a93ef..ff5c4a69d 100644
|
|
|
32cb41 |
--- a/clutter/clutter/clutter-actor.c
|
|
|
32cb41 |
+++ b/clutter/clutter/clutter-actor.c
|
|
|
32cb41 |
@@ -3758,7 +3758,7 @@ clutter_actor_paint_node (ClutterActor *actor,
|
|
|
32cb41 |
clear_flags |= COGL_BUFFER_BIT_COLOR;
|
|
|
32cb41 |
|
|
|
32cb41 |
node = clutter_root_node_new (fb, &bg_color, clear_flags);
|
|
|
32cb41 |
- clutter_paint_node_set_name (node, "stageClear");
|
|
|
32cb41 |
+ clutter_paint_node_set_static_name (node, "stageClear");
|
|
|
32cb41 |
clutter_paint_node_add_rectangle (node, &box);
|
|
|
32cb41 |
clutter_paint_node_add_child (root, node);
|
|
|
32cb41 |
clutter_paint_node_unref (node);
|
|
|
32cb41 |
@@ -3773,7 +3773,7 @@ clutter_actor_paint_node (ClutterActor *actor,
|
|
|
32cb41 |
/ 255;
|
|
|
32cb41 |
|
|
|
32cb41 |
node = clutter_color_node_new (&bg_color);
|
|
|
32cb41 |
- clutter_paint_node_set_name (node, "backgroundColor");
|
|
|
32cb41 |
+ clutter_paint_node_set_static_name (node, "backgroundColor");
|
|
|
32cb41 |
clutter_paint_node_add_rectangle (node, &box);
|
|
|
32cb41 |
clutter_paint_node_add_child (root, node);
|
|
|
32cb41 |
clutter_paint_node_unref (node);
|
|
|
32cb41 |
@@ -4069,7 +4069,7 @@ clutter_actor_continue_paint (ClutterActor *self)
|
|
|
32cb41 |
* virtual function can then be called directly.
|
|
|
32cb41 |
*/
|
|
|
32cb41 |
dummy = _clutter_dummy_node_new (self);
|
|
|
32cb41 |
- clutter_paint_node_set_name (dummy, "Root");
|
|
|
32cb41 |
+ clutter_paint_node_set_static_name (dummy, "Root");
|
|
|
32cb41 |
|
|
|
32cb41 |
/* XXX - for 1.12, we use the return value of paint_node() to
|
|
|
32cb41 |
* decide whether we should emit the ::paint signal.
|
|
|
32cb41 |
@@ -21427,7 +21427,7 @@ clutter_actor_create_texture_paint_node (ClutterActor *self,
|
|
|
32cb41 |
color.alpha = clutter_actor_get_paint_opacity_internal (self);
|
|
|
32cb41 |
|
|
|
32cb41 |
node = clutter_texture_node_new (texture, &color, priv->min_filter, priv->mag_filter);
|
|
|
32cb41 |
- clutter_paint_node_set_name (node, "Texture");
|
|
|
32cb41 |
+ clutter_paint_node_set_static_name (node, "Texture");
|
|
|
32cb41 |
|
|
|
32cb41 |
if (priv->content_repeat == CLUTTER_REPEAT_NONE)
|
|
|
32cb41 |
clutter_paint_node_add_rectangle (node, &box);
|
|
|
32cb41 |
diff --git a/clutter/clutter/clutter-canvas.c b/clutter/clutter/clutter-canvas.c
|
|
|
32cb41 |
index b0f1f080c..89c031be2 100644
|
|
|
32cb41 |
--- a/clutter/clutter/clutter-canvas.c
|
|
|
32cb41 |
+++ b/clutter/clutter/clutter-canvas.c
|
|
|
32cb41 |
@@ -351,7 +351,7 @@ clutter_canvas_paint_content (ClutterContent *content,
|
|
|
32cb41 |
return;
|
|
|
32cb41 |
|
|
|
32cb41 |
node = clutter_actor_create_texture_paint_node (actor, priv->texture);
|
|
|
32cb41 |
- clutter_paint_node_set_name (node, "Canvas Content");
|
|
|
32cb41 |
+ clutter_paint_node_set_static_name (node, "Canvas Content");
|
|
|
32cb41 |
clutter_paint_node_add_child (root, node);
|
|
|
32cb41 |
clutter_paint_node_unref (node);
|
|
|
32cb41 |
|
|
|
32cb41 |
diff --git a/clutter/clutter/clutter-image.c b/clutter/clutter/clutter-image.c
|
|
|
32cb41 |
index 266c68799..790e09521 100644
|
|
|
32cb41 |
--- a/clutter/clutter/clutter-image.c
|
|
|
32cb41 |
+++ b/clutter/clutter/clutter-image.c
|
|
|
32cb41 |
@@ -129,7 +129,7 @@ clutter_image_paint_content (ClutterContent *content,
|
|
|
32cb41 |
return;
|
|
|
32cb41 |
|
|
|
32cb41 |
node = clutter_actor_create_texture_paint_node (actor, priv->texture);
|
|
|
32cb41 |
- clutter_paint_node_set_name (node, "Image Content");
|
|
|
32cb41 |
+ clutter_paint_node_set_static_name (node, "Image Content");
|
|
|
32cb41 |
clutter_paint_node_add_child (root, node);
|
|
|
32cb41 |
clutter_paint_node_unref (node);
|
|
|
32cb41 |
}
|
|
|
32cb41 |
diff --git a/clutter/clutter/clutter-paint-node-private.h b/clutter/clutter/clutter-paint-node-private.h
|
|
|
32cb41 |
index d61b89951..720df1458 100644
|
|
|
32cb41 |
--- a/clutter/clutter/clutter-paint-node-private.h
|
|
|
32cb41 |
+++ b/clutter/clutter/clutter-paint-node-private.h
|
|
|
32cb41 |
@@ -48,11 +48,11 @@ struct _ClutterPaintNode
|
|
|
32cb41 |
ClutterPaintNode *next_sibling;
|
|
|
32cb41 |
ClutterPaintNode *last_child;
|
|
|
32cb41 |
|
|
|
32cb41 |
- guint n_children;
|
|
|
32cb41 |
-
|
|
|
32cb41 |
GArray *operations;
|
|
|
32cb41 |
|
|
|
32cb41 |
- gchar *name;
|
|
|
32cb41 |
+ const gchar *name;
|
|
|
32cb41 |
+
|
|
|
32cb41 |
+ guint n_children;
|
|
|
32cb41 |
|
|
|
32cb41 |
volatile int ref_count;
|
|
|
32cb41 |
};
|
|
|
32cb41 |
diff --git a/clutter/clutter/clutter-paint-node.c b/clutter/clutter/clutter-paint-node.c
|
|
|
32cb41 |
index 73765a4e9..1f9451a43 100644
|
|
|
32cb41 |
--- a/clutter/clutter/clutter-paint-node.c
|
|
|
32cb41 |
+++ b/clutter/clutter/clutter-paint-node.c
|
|
|
32cb41 |
@@ -171,8 +171,6 @@ clutter_paint_node_real_finalize (ClutterPaintNode *node)
|
|
|
32cb41 |
{
|
|
|
32cb41 |
ClutterPaintNode *iter;
|
|
|
32cb41 |
|
|
|
32cb41 |
- g_free (node->name);
|
|
|
32cb41 |
-
|
|
|
32cb41 |
if (node->operations != NULL)
|
|
|
32cb41 |
{
|
|
|
32cb41 |
guint i;
|
|
|
32cb41 |
@@ -294,7 +292,8 @@ clutter_paint_node_get_type (void)
|
|
|
32cb41 |
*
|
|
|
32cb41 |
* The @name will be used for debugging purposes.
|
|
|
32cb41 |
*
|
|
|
32cb41 |
- * The @node will copy the passed string.
|
|
|
32cb41 |
+ * The @node will intern @name using g_intern_string(). If you have access to a
|
|
|
32cb41 |
+ * static string, use clutter_paint_node_set_static_name() instead.
|
|
|
32cb41 |
*
|
|
|
32cb41 |
* Since: 1.10
|
|
|
32cb41 |
*/
|
|
|
32cb41 |
@@ -304,8 +303,22 @@ clutter_paint_node_set_name (ClutterPaintNode *node,
|
|
|
32cb41 |
{
|
|
|
32cb41 |
g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
|
|
|
32cb41 |
|
|
|
32cb41 |
- g_free (node->name);
|
|
|
32cb41 |
- node->name = g_strdup (name);
|
|
|
32cb41 |
+ node->name = g_intern_string (name);
|
|
|
32cb41 |
+}
|
|
|
32cb41 |
+
|
|
|
32cb41 |
+/**
|
|
|
32cb41 |
+ * clutter_paint_node_set_static_name: (skip)
|
|
|
32cb41 |
+ *
|
|
|
32cb41 |
+ * Like clutter_paint_node_set_name() but uses a static or interned string
|
|
|
32cb41 |
+ * containing the name.
|
|
|
32cb41 |
+ */
|
|
|
32cb41 |
+void
|
|
|
32cb41 |
+clutter_paint_node_set_static_name (ClutterPaintNode *node,
|
|
|
32cb41 |
+ const char *name)
|
|
|
32cb41 |
+{
|
|
|
32cb41 |
+ g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
|
|
|
32cb41 |
+
|
|
|
32cb41 |
+ node->name = name;
|
|
|
32cb41 |
}
|
|
|
32cb41 |
|
|
|
32cb41 |
/**
|
|
|
32cb41 |
diff --git a/clutter/clutter/clutter-paint-node.h b/clutter/clutter/clutter-paint-node.h
|
|
|
32cb41 |
index c42abbc3d..7d25f1681 100644
|
|
|
32cb41 |
--- a/clutter/clutter/clutter-paint-node.h
|
|
|
32cb41 |
+++ b/clutter/clutter/clutter-paint-node.h
|
|
|
32cb41 |
@@ -55,6 +55,9 @@ void clutter_paint_node_paint (Clutter
|
|
|
32cb41 |
CLUTTER_EXPORT
|
|
|
32cb41 |
void clutter_paint_node_set_name (ClutterPaintNode *node,
|
|
|
32cb41 |
const char *name);
|
|
|
32cb41 |
+CLUTTER_EXPORT
|
|
|
32cb41 |
+void clutter_paint_node_set_static_name (ClutterPaintNode *node,
|
|
|
32cb41 |
+ const char *name);
|
|
|
32cb41 |
|
|
|
32cb41 |
CLUTTER_EXPORT
|
|
|
32cb41 |
void clutter_paint_node_add_child (ClutterPaintNode *node,
|
|
|
32cb41 |
--
|
|
|
32cb41 |
2.26.0
|
|
|
32cb41 |
|