diff options
author | Matthias Clasen <mclasen@redhat.com> | 2017-10-08 19:21:09 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2017-10-08 19:58:09 -0400 |
commit | 6e5ded849203d619db5455bf4fffd563a994bdf2 (patch) | |
tree | 19535a25995d96986946cd27257b4944ae0c8912 /testsuite/gsk | |
parent | 5280a2c8740f003a1321e4d0f3af79dcf3d4e09d (diff) | |
download | gtk+-6e5ded849203d619db5455bf4fffd563a994bdf2.tar.gz |
Add another blendmodes reftest
This tests all blendmodes. Again, the Vulkan renderer fails.
Diffstat (limited to 'testsuite/gsk')
-rw-r--r-- | testsuite/gsk/blendmodes.node | bin | 0 -> 589787 bytes | |||
-rw-r--r-- | testsuite/gsk/blendmodes.png | bin | 0 -> 122534 bytes | |||
-rw-r--r-- | testsuite/gsk/ducky.png | bin | 0 -> 248546 bytes | |||
-rw-r--r-- | testsuite/gsk/test-render-nodes.c | 70 |
4 files changed, 70 insertions, 0 deletions
diff --git a/testsuite/gsk/blendmodes.node b/testsuite/gsk/blendmodes.node Binary files differnew file mode 100644 index 0000000000..9476bc41ac --- /dev/null +++ b/testsuite/gsk/blendmodes.node diff --git a/testsuite/gsk/blendmodes.png b/testsuite/gsk/blendmodes.png Binary files differnew file mode 100644 index 0000000000..f14aa8ab79 --- /dev/null +++ b/testsuite/gsk/blendmodes.png diff --git a/testsuite/gsk/ducky.png b/testsuite/gsk/ducky.png Binary files differnew file mode 100644 index 0000000000..f1cbd35250 --- /dev/null +++ b/testsuite/gsk/ducky.png diff --git a/testsuite/gsk/test-render-nodes.c b/testsuite/gsk/test-render-nodes.c index fc29d32e75..f10dddc1f4 100644 --- a/testsuite/gsk/test-render-nodes.c +++ b/testsuite/gsk/test-render-nodes.c @@ -259,6 +259,75 @@ blendmode (void) } static GskRenderNode * +ducky (void) +{ + GdkPixbuf *pixbuf; + cairo_surface_t *surface; + GskRenderNode *node; + + pixbuf = gdk_pixbuf_new_from_file_at_size ("ducky.png", 100, 100, NULL); + surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 1, NULL); + node = gsk_cairo_node_new_for_surface (&GRAPHENE_RECT_INIT (0, 0, + cairo_image_surface_get_width (surface), + cairo_image_surface_get_height (surface)), + surface); + g_object_unref (pixbuf); + cairo_surface_destroy (surface); + + return node; +} + +static GskRenderNode * +gradient (void) +{ + return gsk_linear_gradient_node_new (&GRAPHENE_RECT_INIT (0, 0, 100, 100), + &GRAPHENE_POINT_INIT (0, 0), + &GRAPHENE_POINT_INIT (0, 100), + (const GskColorStop[3]) { + { .offset = 0.0, .color = { 1.0, 0.0, 0.0, 1.0 } }, + { .offset = 0.5, .color = { 0.0, 1.0, 0.0, 1.0 } }, + { .offset = 1.0, .color = { 0.0, 0.0, 1.0, 1.0 } } + }, + 3); +} + +static GskRenderNode * +blendmodes (void) +{ + GskRenderNode *child1; + GskRenderNode *child2; + GskRenderNode *container; + GskRenderNode *blend[16]; + GskBlendMode mode; + int i, j; + + child1 = gradient (); + child2 = ducky (); + + for (i = 0, mode = GSK_BLEND_MODE_DEFAULT; i < 4; i++) + for (j = 0; j < 4; j++, mode++) + { + GskRenderNode *b; + graphene_matrix_t matrix; + + b = gsk_blend_node_new (child1, child2, mode); + graphene_matrix_init_translate (&matrix, &(const graphene_point3d_t) { i * 110, j * 110, 0 }); + blend[mode] = gsk_transform_node_new (b, &matrix); + gsk_render_node_unref (b); + } + + gsk_render_node_unref (child1); + gsk_render_node_unref (child2); + + container = gsk_container_node_new (blend, 16); + + for (i = 0; i < 16; i++) + gsk_render_node_unref (blend[i]); + + return container; +} + +static GskRenderNode * cross_fade (void) { GskRenderNode *child1; @@ -292,6 +361,7 @@ static const struct { { "repeat.node", repeat }, { "blendmode.node", blendmode }, { "cross-fade.node", cross_fade }, + { "blendmodes.node", blendmodes }, }; /*** test setup ***/ |