gsk: Add GskRenderNodeType

For now, this is unused.
This commit is contained in:
Benjamin Otte 2016-12-10 21:42:01 +01:00
parent f258af9cce
commit ac5e277a71
6 changed files with 54 additions and 5 deletions

View File

@ -27,6 +27,8 @@ GSK_TYPE_SCALING_FILTER
<FILE>GskRenderNode</FILE>
gsk_render_node_ref
gsk_render_node_unref
GskRenderNodeType
gsk_render_node_get_node_type
gsk_render_node_get_parent
gsk_render_node_get_first_child
gsk_render_node_get_last_child

View File

@ -22,6 +22,24 @@
#error "Only <gsk/gsk.h> can be included directly."
#endif
/**
* GskRenderNodeType:
* @GSK_NOT_A_RENDER_NODE: Error type. No node will ever have this type.
* @GSK_CONTAINER_NODE: A node containing a stack of children
* @GSK_CAIRO_NODE: A node drawing a #cairo_surface_t
* @GSK_TEXTURE_NODE: A node drawing a #GskTexture
*
* The type of a node determines what the node is rendering.
*
* Since: 3.90
**/
typedef enum {
GSK_NOT_A_RENDER_NODE = 0,
GSK_CONTAINER_NODE,
GSK_CAIRO_NODE,
GSK_TEXTURE_NODE
} GskRenderNodeType;
/**
* GskScalingFilter:
* @GSK_SCALING_FILTER_LINEAR: linear interpolation filter

View File

@ -691,7 +691,7 @@ gsk_renderer_create_render_node (GskRenderer *renderer)
{
g_return_val_if_fail (GSK_IS_RENDERER (renderer), NULL);
return gsk_render_node_new ();
return gsk_render_node_new (GSK_CONTAINER_NODE);
}
/*< private >

View File

@ -82,14 +82,20 @@ gsk_render_node_finalize (GskRenderNode *self)
/*< private >
* gsk_render_node_new:
* @renderer: a #GskRenderer
* @type: type of the new node
*
* Returns: (transfer full): the newly created #GskRenderNode
*/
GskRenderNode *
gsk_render_node_new (void)
gsk_render_node_new (GskRenderNodeType type)
{
GskRenderNode *self = g_slice_new0 (GskRenderNode);
GskRenderNode *self;
g_return_val_if_fail (type != GSK_NOT_A_RENDER_NODE, NULL);
self = g_slice_new0 (GskRenderNode);
self->type = type;
self->ref_count = 1;
@ -148,6 +154,24 @@ gsk_render_node_unref (GskRenderNode *node)
gsk_render_node_finalize (node);
}
/**
* gsk_render_node_get_node_type:
* @node: a #GskRenderNode
*
* Returns the type of the @node.
*
* Returns: the type of the #GskRenderNode
*
* Since: 3.90
*/
GskRenderNodeType
gsk_render_node_get_node_type (GskRenderNode *node)
{
g_return_val_if_fail (GSK_IS_RENDER_NODE (node), GSK_NOT_A_RENDER_NODE);
return node->type;
}
/**
* gsk_render_node_get_parent:
* @node: a #GskRenderNode

View File

@ -41,6 +41,9 @@ GskRenderNode * gsk_render_node_ref (GskRenderNode *
GDK_AVAILABLE_IN_3_90
void gsk_render_node_unref (GskRenderNode *node);
GDK_AVAILABLE_IN_3_90
GskRenderNodeType gsk_render_node_get_node_type (GskRenderNode *node);
GDK_AVAILABLE_IN_3_90
GskRenderNode * gsk_render_node_get_parent (GskRenderNode *node);
GDK_AVAILABLE_IN_3_90

View File

@ -8,6 +8,8 @@ G_BEGIN_DECLS
struct _GskRenderNode
{
GskRenderNodeType type;
volatile int ref_count;
/* The graph */
@ -57,7 +59,7 @@ struct _GskRenderNode
gboolean needs_world_matrix_update : 1;
};
GskRenderNode *gsk_render_node_new (void);
GskRenderNode *gsk_render_node_new (GskRenderNodeType type);
void gsk_render_node_make_immutable (GskRenderNode *node);