Introduce ClutterEffectNode
ClutterEffectNode is a private ClutterPaintNode implementation that does effectively nothing, but helps organizing the paint node tree. It also helps debugging, since it can output the effect class and name to the JSON debugging routines. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1340>
This commit is contained in:
parent
3c8bfc1482
commit
e45d1c6ea6
@ -141,6 +141,26 @@ ClutterPaintNode * clutter_paint_node_get_last_child (Clutter
|
|||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
ClutterPaintNode * clutter_paint_node_get_parent (ClutterPaintNode *node);
|
ClutterPaintNode * clutter_paint_node_get_parent (ClutterPaintNode *node);
|
||||||
|
|
||||||
|
|
||||||
|
#define CLUTTER_TYPE_EFFECT_NODE (clutter_effect_node_get_type ())
|
||||||
|
#define CLUTTER_EFFECT_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_EFFECT_NODE, ClutterEffectNode))
|
||||||
|
#define CLUTTER_IS_EFFECT_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_EFFECT_NODE))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterEffectNode:
|
||||||
|
*
|
||||||
|
* The #ClutterEffectNode structure is an opaque
|
||||||
|
* type whose members cannot be directly accessed.
|
||||||
|
*/
|
||||||
|
typedef struct _ClutterEffectNode ClutterEffectNode;
|
||||||
|
typedef struct _ClutterEffectNode ClutterEffectNodeClass;
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
GType clutter_effect_node_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
ClutterPaintNode * clutter_effect_node_new (ClutterEffect *effect);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_PAINT_NODE_PRIVATE_H__ */
|
#endif /* __CLUTTER_PAINT_NODE_PRIVATE_H__ */
|
||||||
|
@ -1216,6 +1216,90 @@ clutter_actor_node_new (ClutterActor *actor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ClutterEffectNode
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct _ClutterEffectNode
|
||||||
|
{
|
||||||
|
ClutterPaintNode parent_instance;
|
||||||
|
|
||||||
|
ClutterEffect *effect;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _ClutterEffectNodeClass
|
||||||
|
{
|
||||||
|
ClutterPaintNodeClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (ClutterEffectNode, clutter_effect_node, CLUTTER_TYPE_PAINT_NODE)
|
||||||
|
|
||||||
|
static JsonNode *
|
||||||
|
clutter_effect_node_serialize (ClutterPaintNode *node)
|
||||||
|
{
|
||||||
|
ClutterEffectNode *effect_node = CLUTTER_EFFECT_NODE (node);
|
||||||
|
ClutterActorMeta *effect_meta = CLUTTER_ACTOR_META (effect_node->effect);
|
||||||
|
g_autoptr (JsonBuilder) builder = NULL;
|
||||||
|
g_autoptr (GString) string = NULL;
|
||||||
|
const char *meta_name;
|
||||||
|
|
||||||
|
meta_name = clutter_actor_meta_get_name (effect_meta);
|
||||||
|
|
||||||
|
string = g_string_new (NULL);
|
||||||
|
g_string_append (string, G_OBJECT_TYPE_NAME (effect_node->effect));
|
||||||
|
g_string_append (string, " (");
|
||||||
|
if (meta_name)
|
||||||
|
g_string_append_printf (string, "\"%s\"", meta_name);
|
||||||
|
else
|
||||||
|
g_string_append (string, "unnamed");
|
||||||
|
g_string_append (string, ")");
|
||||||
|
|
||||||
|
builder = json_builder_new ();
|
||||||
|
|
||||||
|
json_builder_begin_object (builder);
|
||||||
|
json_builder_set_member_name (builder, "effect");
|
||||||
|
json_builder_add_string_value (builder, string->str);
|
||||||
|
json_builder_end_object (builder);
|
||||||
|
|
||||||
|
return json_builder_get_root (builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_effect_node_class_init (ClutterEffectNodeClass *klass)
|
||||||
|
{
|
||||||
|
ClutterPaintNodeClass *node_class;
|
||||||
|
|
||||||
|
node_class = CLUTTER_PAINT_NODE_CLASS (klass);
|
||||||
|
node_class->serialize = clutter_effect_node_serialize;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_effect_node_init (ClutterEffectNode *self)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_effect_node_new:
|
||||||
|
* @effect: the actor to paint
|
||||||
|
*
|
||||||
|
* Creates a new #ClutterEffectNode.
|
||||||
|
*
|
||||||
|
* Return value: (transfer full): the newly created #ClutterEffectNode.
|
||||||
|
* Use clutter_paint_node_unref() when done.
|
||||||
|
*/
|
||||||
|
ClutterPaintNode *
|
||||||
|
clutter_effect_node_new (ClutterEffect *effect)
|
||||||
|
{
|
||||||
|
ClutterEffectNode *res;
|
||||||
|
|
||||||
|
g_assert (CLUTTER_IS_EFFECT (effect));
|
||||||
|
|
||||||
|
res = _clutter_paint_node_create (CLUTTER_TYPE_EFFECT_NODE);
|
||||||
|
res->effect = effect;
|
||||||
|
|
||||||
|
return (ClutterPaintNode *) res;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ClutterLayerNode
|
* ClutterLayerNode
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user