[gtk+] gsk: Add GskRenderNodeType
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gsk: Add GskRenderNodeType
- Date: Tue, 20 Dec 2016 17:08:19 +0000 (UTC)
commit ac5e277a71003ef01e049b1b2d6aea1c447146f3
Author: Benjamin Otte <otte redhat com>
Date: Sat Dec 10 21:42:01 2016 +0100
gsk: Add GskRenderNodeType
For now, this is unused.
docs/reference/gsk/gsk4-sections.txt | 2 ++
gsk/gskenums.h | 18 ++++++++++++++++++
gsk/gskrenderer.c | 2 +-
gsk/gskrendernode.c | 30 +++++++++++++++++++++++++++---
gsk/gskrendernode.h | 3 +++
gsk/gskrendernodeprivate.h | 4 +++-
6 files changed, 54 insertions(+), 5 deletions(-)
---
diff --git a/docs/reference/gsk/gsk4-sections.txt b/docs/reference/gsk/gsk4-sections.txt
index 0282fd2..6518d1f 100644
--- a/docs/reference/gsk/gsk4-sections.txt
+++ b/docs/reference/gsk/gsk4-sections.txt
@@ -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
diff --git a/gsk/gskenums.h b/gsk/gskenums.h
index 28d4dca..9040c69 100644
--- a/gsk/gskenums.h
+++ b/gsk/gskenums.h
@@ -23,6 +23,24 @@
#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
* @GSK_SCALING_FILTER_NEAREST: nearest neighbor interpolation filter
diff --git a/gsk/gskrenderer.c b/gsk/gskrenderer.c
index 7682e9f..8738067 100644
--- a/gsk/gskrenderer.c
+++ b/gsk/gskrenderer.c
@@ -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 >
diff --git a/gsk/gskrendernode.c b/gsk/gskrendernode.c
index 13869e1..aced1e4 100644
--- a/gsk/gskrendernode.c
+++ b/gsk/gskrendernode.c
@@ -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;
@@ -149,6 +155,24 @@ gsk_render_node_unref (GskRenderNode *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
*
diff --git a/gsk/gskrendernode.h b/gsk/gskrendernode.h
index 74fdf0d..5af118b 100644
--- a/gsk/gskrendernode.h
+++ b/gsk/gskrendernode.h
@@ -42,6 +42,9 @@ 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
GskRenderNode * gsk_render_node_get_first_child (GskRenderNode *node);
diff --git a/gsk/gskrendernodeprivate.h b/gsk/gskrendernodeprivate.h
index 43b2970..6307989 100644
--- a/gsk/gskrendernodeprivate.h
+++ b/gsk/gskrendernodeprivate.h
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]