gtk/testsuite/gsk/compare/offscreen-pixel-alignment-nogl-nocairo.node
Benjamin Otte f0e6c03d94 testsuite: Add a test for pixel alignment of offscreens
The test ensures that offscreens render to the same pixel grid as the
actual image, and they are not offset by fractions of a pixel.

The Cairo renderer fails here because Cairo's clipping code rounds pixel
values wrong.
2024-01-03 04:11:35 +01:00

33 lines
828 B
Plaintext

/* ensure the size of this test */
color {
bounds: 0 0 50 50;
color: black;
}
clip {
/* Use a clip that isn't pixel-aligned.
Use 2 numbers that divide 255 so the expected pixel
doesn't cause rounding issues. */
clip: 3.333333 3.4 43 43;
/* Use a shadow node to force an offscreen */
child: shadow {
shadows: yellow 1 0;
/* Generate a checkerboard pattern with 1x1 tiles.
It is very obvious when those don't get pixel-aligned. */
child: repeat {
/* Make sure the bounds extend beyond the clip, so no
antialiasing artifacts are caused by the pattern. */
bounds: 0 0 50 50;
child: container {
color {
color: red;
bounds: 0 0 1 1;
}
color {
color: red;
bounds: 1 1 1 1;
}
}
}
}
}