[gtk+] gsk: Store blend mode in the render node



commit 81e992e1ff2ee4e9647e33e799b661ef881915f8
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Fri Jul 1 12:12:30 2016 +0100

    gsk: Store blend mode in the render node

 gsk/gskrendernode.c        |   43 +++++++++++++++++++++++++++++++++++++++++++
 gsk/gskrendernode.h        |    6 ++++++
 gsk/gskrendernodeprivate.h |    3 +++
 3 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/gsk/gskrendernode.c b/gsk/gskrendernode.c
index 2de6506..b9ab330 100644
--- a/gsk/gskrendernode.c
+++ b/gsk/gskrendernode.c
@@ -1227,6 +1227,49 @@ gsk_render_node_set_name (GskRenderNode *node,
 }
 
 /**
+ * gsk_render_node_set_blend_mode:
+ * @node: a #GskRenderNode
+ * @blend_mode: the blend mode to be applied to the node's children
+ *
+ * Sets the blend mode to be used when rendering the children
+ * of the @node.
+ *
+ * The default value is %GSK_BLEND_MODE_DEFAULT.
+ *
+ * Since: 3.22
+ */
+void
+gsk_render_node_set_blend_mode (GskRenderNode *node,
+                                GskBlendMode   blend_mode)
+{
+  g_return_if_fail (GSK_IS_RENDER_NODE (node));
+  g_return_if_fail (!node->is_mutable);
+
+  if (node->blend_mode == blend_mode)
+    return;
+
+  node->blend_mode = blend_mode;
+}
+
+/**
+ * gsk_render_node_get_blend_mode:
+ * @node: a #GskRenderNode
+ *
+ * Retrieves the blend mode set by gsk_render_node_set_blend_mode().
+ *
+ * Returns: the blend mode
+ *
+ * Since: 3.22
+ */
+GskBlendMode
+gsk_render_node_get_blend_mode (GskRenderNode *node)
+{
+  g_return_val_if_fail (GSK_IS_RENDER_NODE (node), GSK_BLEND_MODE_DEFAULT);
+
+  return node->blend_mode;
+}
+
+/**
  * gsk_render_node_get_draw_context:
  * @node: a #GskRenderNode
  *
diff --git a/gsk/gskrendernode.h b/gsk/gskrendernode.h
index d8b57e2..a4709ff 100644
--- a/gsk/gskrendernode.h
+++ b/gsk/gskrendernode.h
@@ -116,6 +116,12 @@ GDK_AVAILABLE_IN_3_22
 cairo_t *               gsk_render_node_get_draw_context        (GskRenderNode   *node);
 
 GDK_AVAILABLE_IN_3_22
+void                    gsk_render_node_set_blend_mode          (GskRenderNode *node,
+                                                                 GskBlendMode   blend_mode);
+GDK_AVAILABLE_IN_3_22
+GskBlendMode            gsk_render_node_get_blend_mode          (GskRenderNode *node);
+
+GDK_AVAILABLE_IN_3_22
 void                    gsk_render_node_set_name                (GskRenderNode *node,
                                                                  const char    *name);
 
diff --git a/gsk/gskrendernodeprivate.h b/gsk/gskrendernodeprivate.h
index 7aa100b..9893f96 100644
--- a/gsk/gskrendernodeprivate.h
+++ b/gsk/gskrendernodeprivate.h
@@ -37,6 +37,9 @@ struct _GskRenderNode
   /* Paint opacity */
   double opacity;
 
+  /* Blend mode */
+  GskBlendMode blend_mode;
+
   /* Clip rectangle */
   graphene_rect_t bounds;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]