diff options
author | Matthias Clasen <mclasen@redhat.com> | 2017-10-08 14:29:27 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2017-10-08 14:29:27 -0400 |
commit | eacdeec29ee66617c77057680a0f7c79fe12db23 (patch) | |
tree | 4d09e3ffbf6e29740ae4f3f553423385a65d5cf8 /testsuite/gsk | |
parent | ab22734159e12e3828152e4c29395f5b59f1e45b (diff) | |
download | gtk+-eacdeec29ee66617c77057680a0f7c79fe12db23.tar.gz |
Add a blendmode node reftest
The Vulkan renderer doesn't pass this, currently.
Diffstat (limited to 'testsuite/gsk')
-rw-r--r-- | testsuite/gsk/blendmode.node | bin | 0 -> 640320 bytes | |||
-rw-r--r-- | testsuite/gsk/blendmode.png | bin | 0 -> 1983 bytes | |||
-rw-r--r-- | 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 Binary files differnew file mode 100644 index 0000000000..c6a9e85e69 --- /dev/null +++ b/testsuite/gsk/blendmode.node diff --git a/testsuite/gsk/blendmode.png b/testsuite/gsk/blendmode.png Binary files differnew file mode 100644 index 0000000000..36a8203d8c --- /dev/null +++ b/testsuite/gsk/blendmode.png diff --git a/testsuite/gsk/test-render-nodes.c b/testsuite/gsk/test-render-nodes.c index f39f725540..f3d65f4999 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 ***/ |