mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
clutter/paint-nodes: Introduce ClutterActorNode
ClutterActorNode is a paint node that runs the 'paint' function of an actor. It is a useful helper node to be used during the transition to paint nodes. The role of ClutterActorNode will change over time. For now, it is just a call to clutter_actor_continue_paint(), which also paints the effects. When ClutterEffect is ported to paint nodes, ClutterActorNode will morph to only notify the actor about the painting, and will become a private node to Clutter. https://gitlab.gnome.org/GNOME/mutter/merge_requests/872
This commit is contained in:
parent
cf791c09f0
commit
ebf9ac091d
@ -1081,6 +1081,99 @@ clutter_clip_node_new (void)
|
|||||||
return _clutter_paint_node_create (CLUTTER_TYPE_CLIP_NODE);
|
return _clutter_paint_node_create (CLUTTER_TYPE_CLIP_NODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ClutterActorNode
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct _ClutterActorNode
|
||||||
|
{
|
||||||
|
ClutterPaintNode parent_instance;
|
||||||
|
|
||||||
|
ClutterActor *actor;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _ClutterActorNodeClass
|
||||||
|
{
|
||||||
|
ClutterPaintNodeClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (ClutterActorNode, clutter_actor_node, CLUTTER_TYPE_PAINT_NODE)
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
clutter_actor_node_pre_draw (ClutterPaintNode *node)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_actor_node_draw (ClutterPaintNode *node)
|
||||||
|
{
|
||||||
|
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
|
||||||
|
|
||||||
|
clutter_actor_continue_paint (actor_node->actor);
|
||||||
|
}
|
||||||
|
|
||||||
|
static JsonNode *
|
||||||
|
clutter_actor_node_serialize (ClutterPaintNode *node)
|
||||||
|
{
|
||||||
|
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
|
||||||
|
g_autoptr (JsonBuilder) builder = NULL;
|
||||||
|
const char *debug_name;
|
||||||
|
|
||||||
|
debug_name = _clutter_actor_get_debug_name (actor_node->actor);
|
||||||
|
|
||||||
|
builder = json_builder_new ();
|
||||||
|
|
||||||
|
json_builder_begin_object (builder);
|
||||||
|
json_builder_set_member_name (builder, "actor");
|
||||||
|
json_builder_add_string_value (builder, debug_name);
|
||||||
|
json_builder_end_object (builder);
|
||||||
|
|
||||||
|
return json_builder_get_root (builder);
|
||||||
|
}
|
||||||
|
static void
|
||||||
|
clutter_actor_node_class_init (ClutterActorNodeClass *klass)
|
||||||
|
{
|
||||||
|
ClutterPaintNodeClass *node_class;
|
||||||
|
|
||||||
|
node_class = CLUTTER_PAINT_NODE_CLASS (klass);
|
||||||
|
node_class->pre_draw = clutter_actor_node_pre_draw;
|
||||||
|
node_class->draw = clutter_actor_node_draw;
|
||||||
|
node_class->serialize = clutter_actor_node_serialize;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_actor_node_init (ClutterActorNode *self)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* clutter_actor_node_new:
|
||||||
|
* @actor: the actor to paint
|
||||||
|
*
|
||||||
|
* Creates a new #ClutterActorNode.
|
||||||
|
*
|
||||||
|
* The actor is painted together with any effects
|
||||||
|
* applied to it. Children of this node will draw
|
||||||
|
* over the actor contents.
|
||||||
|
*
|
||||||
|
* Return value: (transfer full): the newly created #ClutterActorNode.
|
||||||
|
* Use clutter_paint_node_unref() when done.
|
||||||
|
*/
|
||||||
|
ClutterPaintNode *
|
||||||
|
clutter_actor_node_new (ClutterActor *actor)
|
||||||
|
{
|
||||||
|
ClutterActorNode *res;
|
||||||
|
|
||||||
|
g_assert (actor != NULL);
|
||||||
|
|
||||||
|
res = _clutter_paint_node_create (CLUTTER_TYPE_ACTOR_NODE);
|
||||||
|
res->actor = actor;
|
||||||
|
|
||||||
|
return (ClutterPaintNode *) res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ClutterLayerNode
|
* ClutterLayerNode
|
||||||
*/
|
*/
|
||||||
|
@ -143,6 +143,25 @@ CLUTTER_EXPORT
|
|||||||
ClutterPaintNode * clutter_text_node_new (PangoLayout *layout,
|
ClutterPaintNode * clutter_text_node_new (PangoLayout *layout,
|
||||||
const ClutterColor *color);
|
const ClutterColor *color);
|
||||||
|
|
||||||
|
#define CLUTTER_TYPE_ACTOR_NODE (clutter_actor_node_get_type ())
|
||||||
|
#define CLUTTER_ACTOR_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ACTOR_NODE, ClutterActorNode))
|
||||||
|
#define CLUTTER_IS_ACTOR_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ACTOR_NODE))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterActorNode:
|
||||||
|
*
|
||||||
|
* The #ClutterActorNode structure is an opaque
|
||||||
|
* type whose members cannot be directly accessed.
|
||||||
|
*/
|
||||||
|
typedef struct _ClutterActorNode ClutterActorNode;
|
||||||
|
typedef struct _ClutterActorNode ClutterActorNodeClass;
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
GType clutter_actor_node_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
ClutterPaintNode * clutter_actor_node_new (ClutterActor *actor);
|
||||||
|
|
||||||
#define CLUTTER_TYPE_ROOT_NODE (clutter_root_node_get_type ())
|
#define CLUTTER_TYPE_ROOT_NODE (clutter_root_node_get_type ())
|
||||||
#define CLUTTER_ROOT_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ROOT_NODE, ClutterRootNode))
|
#define CLUTTER_ROOT_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ROOT_NODE, ClutterRootNode))
|
||||||
#define CLUTTER_IS_ROOT_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ROOT_NODE))
|
#define CLUTTER_IS_ROOT_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ROOT_NODE))
|
||||||
|
Loading…
Reference in New Issue
Block a user