summaryrefslogtreecommitdiff
path: root/test/rotate-image-surface-paint.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-08-19 12:22:52 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-08-20 14:11:30 +0100
commit2134306eaf3fda10ca89f0acac9ef6d69888690e (patch)
tree6b1f04891bd787480348b14ca787b7570aab5924 /test/rotate-image-surface-paint.c
parent9f6820210d992a860c88e2a42c1f4bcd4a2de816 (diff)
test: Extend rotate-image-surface-paint
Apply two common clipping methods just to add a little bit of further complication. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'test/rotate-image-surface-paint.c')
-rw-r--r--test/rotate-image-surface-paint.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/test/rotate-image-surface-paint.c b/test/rotate-image-surface-paint.c
index f592d630..42fda6ec 100644
--- a/test/rotate-image-surface-paint.c
+++ b/test/rotate-image-surface-paint.c
@@ -90,6 +90,64 @@ draw (cairo_t *cr, int width, int height)
return CAIRO_TEST_SUCCESS;
}
+static cairo_test_status_t
+clip_draw (cairo_t *cr, int width, int height)
+{
+ cairo_pattern_t *source;
+ int surface_size = sqrt ((SIZE - 2*PAD)*(SIZE - 2*PAD)/2);
+
+ /* Use a gray (neutral) background, so we can spot if the backend pads
+ * with any other colour.
+ */
+ cairo_set_source_rgb (cr, .5, .5, .5);
+ cairo_paint (cr);
+
+ cairo_rectangle (cr, 2*PAD, 2*PAD, SIZE-4*PAD, SIZE-4*PAD);
+ cairo_clip (cr);
+
+ cairo_translate(cr, SIZE/2, SIZE/2);
+ cairo_rotate (cr, M_PI / 4.0);
+ cairo_translate (cr, -surface_size/2, -surface_size/2);
+
+ source = create_image_source (surface_size);
+ cairo_pattern_set_filter (source, CAIRO_FILTER_NEAREST);
+ cairo_set_source(cr, source);
+ cairo_pattern_destroy (source);
+
+ cairo_paint (cr);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+static cairo_test_status_t
+draw_clip (cairo_t *cr, int width, int height)
+{
+ cairo_pattern_t *source;
+ int surface_size = sqrt ((SIZE - 2*PAD)*(SIZE - 2*PAD)/2);
+
+ /* Use a gray (neutral) background, so we can spot if the backend pads
+ * with any other colour.
+ */
+ cairo_set_source_rgb (cr, .5, .5, .5);
+ cairo_paint (cr);
+
+ cairo_translate(cr, SIZE/2, SIZE/2);
+ cairo_rotate (cr, M_PI / 4.0);
+ cairo_translate (cr, -surface_size/2, -surface_size/2);
+
+ cairo_rectangle (cr, PAD, PAD, surface_size-2*PAD, surface_size-2*PAD);
+ cairo_clip (cr);
+
+ source = create_image_source (surface_size);
+ cairo_pattern_set_filter (source, CAIRO_FILTER_NEAREST);
+ cairo_set_source(cr, source);
+ cairo_pattern_destroy (source);
+
+ cairo_paint (cr);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
CAIRO_TEST (rotate_image_surface_paint,
"Test call sequence: image_surface_create; rotate; set_source_surface; paint"
"\nThis test is known to fail on the ps backend currently",
@@ -97,3 +155,18 @@ CAIRO_TEST (rotate_image_surface_paint,
NULL, /* requirements */
SIZE, SIZE,
NULL, draw)
+
+CAIRO_TEST (clip_rotate_image_surface_paint,
+ "Test call sequence: image_surface_create; rotate; set_source_surface; paint"
+ "\nThis test is known to fail on the ps backend currently",
+ "image, transform, paint", /* keywords */
+ NULL, /* requirements */
+ SIZE, SIZE,
+ NULL, clip_draw)
+CAIRO_TEST (rotate_clip_image_surface_paint,
+ "Test call sequence: image_surface_create; rotate; set_source_surface; paint"
+ "\nThis test is known to fail on the ps backend currently",
+ "image, transform, paint", /* keywords */
+ NULL, /* requirements */
+ SIZE, SIZE,
+ NULL, draw_clip)