[gtk+] Add a blendmode node reftest



commit eacdeec29ee66617c77057680a0f7c79fe12db23
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Oct 8 14:29:27 2017 -0400

    Add a blendmode node reftest
    
    The Vulkan renderer doesn't pass this, currently.

 testsuite/gsk/blendmode.node      |  Bin 0 -> 640320 bytes
 testsuite/gsk/blendmode.png       |  Bin 0 -> 1983 bytes
 testsuite/gsk/test-render-nodes.c |   54 +++++++++++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+), 0 deletions(-)
---
diff --git a/testsuite/gsk/blendmode.node b/testsuite/gsk/blendmode.node
new file mode 100644
index 0000000..c6a9e85
Binary files /dev/null and b/testsuite/gsk/blendmode.node differ
diff --git a/testsuite/gsk/blendmode.png b/testsuite/gsk/blendmode.png
new file mode 100644
index 0000000..36a8203
Binary files /dev/null and b/testsuite/gsk/blendmode.png differ
diff --git a/testsuite/gsk/test-render-nodes.c b/testsuite/gsk/test-render-nodes.c
index f39f725..f3d65f4 100644
--- a/testsuite/gsk/test-render-nodes.c
+++ b/testsuite/gsk/test-render-nodes.c
@@ -155,6 +155,34 @@ cairo (void)
 }
 
 static GskRenderNode *
+cairo2 (void)
+{
+  GskRenderNode *node;
+  cairo_surface_t *surface;
+  cairo_t *cr;
+  int i, j;
+
+  surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 200, 200);
+  cr = cairo_create (surface);
+
+  cairo_set_source_rgb (cr, 1, 1, 1);
+
+  for (i = 0; i < 10; i++)
+    for (j = 0; j < 10; j++)
+      {
+        cairo_rectangle (cr, i*20, j*20, 10, 10);
+        cairo_fill (cr);
+      }
+
+  node = gsk_cairo_node_new_for_surface (&GRAPHENE_RECT_INIT (0, 0, 200, 200), surface);
+
+  cairo_destroy (cr);
+  cairo_surface_destroy (surface);
+
+  return node;
+}
+
+static GskRenderNode *
 repeat (void)
 {
   GskRenderNode *repeat[4];
@@ -205,6 +233,31 @@ repeat (void)
   return container;
 }
 
+static GskRenderNode *
+blendmode (void)
+{
+  GskRenderNode *child1;
+  GskRenderNode *child2;
+  GskRenderNode *transform;
+  GskRenderNode *container;
+  graphene_matrix_t matrix;
+
+  child1 = cairo ();
+  child2 = cairo2 ();
+
+  graphene_matrix_init_translate (&matrix, &(const graphene_point3d_t) { 50, 50, 0 });
+  transform = gsk_transform_node_new (child2, &matrix);
+  gsk_render_node_unref (child2);
+  child2 = transform;
+
+  container = gsk_blend_node_new (child1, child2, GSK_BLEND_MODE_HUE);
+
+  gsk_render_node_unref (child1);
+  gsk_render_node_unref (child2);
+
+  return container;
+}
+
 static const struct {
   const char *name;
   GskRenderNode * (* func) (void);
@@ -212,6 +265,7 @@ static const struct {
   { "colors.node", colors },
   { "cairo.node", cairo },
   { "repeat.node", repeat },
+  { "blendmode.node", blendmode },
 };
 
 /*** test setup ***/


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