summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-09-30 16:14:57 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-09-30 16:15:33 +0100
commit0c42d5c176b27725ac8ab293c3e941be64f51613 (patch)
treeac5b02a9924fa36c343fe6c8575f87c4218d27df
parent95e147bfa05a122541645f32be52cf1902c3a4b2 (diff)
downloadcairo-0c42d5c176b27725ac8ab293c3e941be64f51613.tar.gz
test: Add another coverage example demonstrating the seams in tor
References: https://bugs.freedesktop.org/show_bug.cgi?id=84396 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--test/coverage.c53
-rw-r--r--test/reference/coverage-abutting.ref.pngbin0 -> 777 bytes
2 files changed, 53 insertions, 0 deletions
diff --git a/test/coverage.c b/test/coverage.c
index fdf801284..2f0e21229 100644
--- a/test/coverage.c
+++ b/test/coverage.c
@@ -287,6 +287,53 @@ triangles (cairo_t *cr, int width, int height)
}
static cairo_test_status_t
+abutting (cairo_t *cr, int width, int height)
+{
+ int x, y;
+
+ cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
+ cairo_paint (cr);
+
+ cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.75);
+
+#if GENERATE_REFERENCE
+ cairo_paint (cr);
+#else
+ cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+
+ for (y = 0; y < 16; y++) {
+ for (x = 0; x < 16; x++) {
+ double theta = (y * 16 + x) * M_PI / 512;
+ double cx = 16 * cos (theta) + x * 16;
+ double cy = 16 * sin (theta) + y * 16;
+
+ cairo_move_to (cr, x * 16, y * 16);
+ cairo_line_to (cr, cx, cy);
+ cairo_line_to (cr, (x + 1) * 16, y * 16);
+ cairo_fill (cr);
+
+ cairo_move_to (cr, (x + 1) * 16, y * 16);
+ cairo_line_to (cr, cx, cy);
+ cairo_line_to (cr, (x + 1) * 16, (y + 1) * 16);
+ cairo_fill (cr);
+
+ cairo_move_to (cr, (x + 1) * 16, (y + 1) * 16);
+ cairo_line_to (cr, cx, cy);
+ cairo_line_to (cr, x * 16, (y + 1) * 16);
+ cairo_fill (cr);
+
+ cairo_move_to (cr, x * 16, (y + 1) * 16);
+ cairo_line_to (cr, cx, cy);
+ cairo_line_to (cr, x * 16, y * 16);
+ cairo_fill (cr);
+ }
+ }
+#endif
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+static cairo_test_status_t
column_triangles (cairo_t *cr, int width, int height)
{
int x, y, i, channel;
@@ -451,3 +498,9 @@ CAIRO_TEST (coverage_triangles,
"target=raster", /* requirements */
WIDTH, HEIGHT,
NULL, triangles)
+CAIRO_TEST (coverage_abutting,
+ "Check the fidelity of the rasterisation.",
+ NULL, /* keywords */
+ "target=raster", /* requirements */
+ 16*16, 16*16,
+ NULL, abutting)
diff --git a/test/reference/coverage-abutting.ref.png b/test/reference/coverage-abutting.ref.png
new file mode 100644
index 000000000..8e37ca313
--- /dev/null
+++ b/test/reference/coverage-abutting.ref.png
Binary files differ