diff --git a/testsuite/gsk/compare/offscreen-pixel-alignment2.node b/testsuite/gsk/compare/offscreen-pixel-alignment2.node new file mode 100644 index 0000000000..09c2339aee --- /dev/null +++ b/testsuite/gsk/compare/offscreen-pixel-alignment2.node @@ -0,0 +1,45 @@ +/* generate the outline, and ensure the bounds are set */ +color { + bounds: 0 0 15 15; + color: black; +} + +/* scale by 1.5 to get into fractional scaling mode */ +transform { + transform: scale(1.5); + /* Use opacity node to get an offscreen + (also makes Cairo not round pixel values wrong) */ + child: opacity { + opacity: 0.4; + /* We use a container with overlapping children here + to force the offscreen */ + child: container { + /* This color node is not pixel-aligned with + the pixel grid - it's at (1.5, 1.5) in pixel coords. + + So the offscreen needs to account for this + and ensure to grow larger than the bounds + if it wants to keep the pixel grid. + + We use the same color as the background above, + so that we don't get comparison artifacts + when blending. */ + color { + color: black; + bounds: 1 1 8 8; + } + /* This color node is aligned with the pixel grid - + It's at (3, 3) in pixel coords. + + But it's drawn to an offscreen first, so if the + offscreen is not pixel-aligned, this boundary + will be blurry. + ^^^ + THIS IS WHAT THE WHOLE TEST IS ABOUT! */ + color { + color: red; + bounds: 2 2 6 6; + } + } + } +} diff --git a/testsuite/gsk/compare/offscreen-pixel-alignment2.png b/testsuite/gsk/compare/offscreen-pixel-alignment2.png new file mode 100644 index 0000000000..120404113e Binary files /dev/null and b/testsuite/gsk/compare/offscreen-pixel-alignment2.png differ diff --git a/testsuite/gsk/meson.build b/testsuite/gsk/meson.build index 93552ff4e9..696e9da8bf 100644 --- a/testsuite/gsk/meson.build +++ b/testsuite/gsk/meson.build @@ -100,6 +100,7 @@ compare_render_tests = [ 'nested-rounded-clips', 'offscreen-fractional-translate-nogl', 'offscreen-pixel-alignment-nogl-nocairo', + 'offscreen-pixel-alignment2', 'opacity_clip', 'opacity-colormatrix-combinations', 'opacity-overdraw',