diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-06-10 11:28:26 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-06-10 12:05:41 +0100 |
commit | 486118361ad0c2e68fa9f6b44ddb10e84d237eca (patch) | |
tree | 340463f7d13ce42538f5eba90e7028f4db5bb71e /test | |
parent | 5cb764850f7c405085739647bac2809045e7cdf3 (diff) |
test: Fix half-coverage colouration.
Hmm, red over red makes the test pointless. The test still remains of
highly dubious quality, as it primarily serves as a rendercheck more
than a test of Cairo. The best hope for this test is that it inspires a
better one.
And incorporate the notes made by Joonas.
Diffstat (limited to 'test')
-rw-r--r-- | test/half-coverage.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/test/half-coverage.c b/test/half-coverage.c index e7880ecf..8dc97845 100644 --- a/test/half-coverage.c +++ b/test/half-coverage.c @@ -41,6 +41,7 @@ rectangles (cairo_t *cr, int width, int height) cairo_set_source_rgb (cr, 1.0, 0.0, 0.0); cairo_paint (cr); + cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); for (i = 1; i <= SIZE; i++) { int x, y; @@ -52,6 +53,14 @@ rectangles (cairo_t *cr, int width, int height) cairo_scale (cr, 1./SIZE, 1./SIZE); for (x = -i; x < SIZE*WIDTH; x += 2*i) { for (y = -i; y < SIZE*HEIGHT; y += 2*i) { + /* Add a little tile composed of two non-overlapping squares + * +--+ + * | | + * |__|__ + * | | + * | | + * +--+ + */ cairo_rectangle (cr, x, y, i, i); cairo_rectangle (cr, x+i, y+i, i, i); } @@ -72,6 +81,7 @@ triangles (cairo_t *cr, int width, int height) cairo_set_source_rgb (cr, 1.0, 0.0, 0.0); cairo_paint (cr); + cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); for (i = 1; i <= SIZE; i++) { int x, y; @@ -83,22 +93,38 @@ triangles (cairo_t *cr, int width, int height) cairo_scale (cr, 1./SIZE, 1./SIZE); for (x = -i; x < SIZE*WIDTH; x += 2*i) { for (y = -i; y < SIZE*HEIGHT; y += 2*i) { - /* add internal edges just for fun */ + /* Add a tile composed of four non-overlapping + * triangles. The plus and minus signs inside the + * triangles denote the orientation of the triangle's + * edges: + for clockwise and - for anticlockwise. + * + * +-----+ + * \-|+/ + * \|/ + * /|\ + * /-|-\ + * +-----+ + */ + + /* top left triangle */ cairo_move_to (cr, x, y); cairo_line_to (cr, x+i, y+i); cairo_line_to (cr, x+i, y); cairo_close_path (cr); + /* top right triangle */ cairo_move_to (cr, x+i, y); cairo_line_to (cr, x+2*i, y); cairo_line_to (cr, x+i, y+i); cairo_close_path (cr); + /* bottom left triangle */ cairo_move_to (cr, x+i, y+i); cairo_line_to (cr, x, y+2*i); cairo_line_to (cr, x+i, y+2*i); cairo_close_path (cr); + /* bottom right triangle */ cairo_move_to (cr, x+i, y+i); cairo_line_to (cr, x+i, y+2*i); cairo_line_to (cr, x+2*i, y+2*i); |