diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-10-21 11:18:37 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-10-21 11:31:10 +0100 |
commit | 6d41ffbbed2ad3bab2b1a58e1e5d9e1570a37926 (patch) | |
tree | 35a646f29150f8a1bc0ad97a4007c27b9c4b277c /test/pixman-rotate.c | |
parent | 64949b81735ee4e43772224d10031f7edfbc8068 (diff) | |
download | cairo-6d41ffbbed2ad3bab2b1a58e1e5d9e1570a37926.tar.gz |
[test/pixman-rotate] Propagate errors
Use cairo_get_target() to propagate errors from the secondary context.
Diffstat (limited to 'test/pixman-rotate.c')
-rw-r--r-- | test/pixman-rotate.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/test/pixman-rotate.c b/test/pixman-rotate.c index d115494b7..313b34d7a 100644 --- a/test/pixman-rotate.c +++ b/test/pixman-rotate.c @@ -55,10 +55,25 @@ draw (cairo_t *cr, int width, int height) cairo_surface_t *stamp; cairo_t *cr2; + /* Draw a translucent rectangle for reference where the rotated + * image should be. */ + cairo_new_path (cr); + cairo_rectangle (cr, WIDTH, HEIGHT, WIDTH, HEIGHT); + cairo_set_source_rgba (cr, 1, 1, 0, 0.3); + cairo_fill (cr); + +#if 1 /* Set to 0 to generate reference image */ + cairo_translate (cr, 2 * WIDTH, 2 * HEIGHT); + cairo_rotate (cr, M_PI); +#else + cairo_translate (cr, WIDTH, HEIGHT); +#endif + stamp = cairo_surface_create_similar (cairo_get_group_target (cr), CAIRO_CONTENT_COLOR_ALPHA, WIDTH, HEIGHT); cr2 = cairo_create (stamp); + cairo_surface_destroy (stamp); { cairo_new_path (cr2); cairo_rectangle (cr2, WIDTH / 4, HEIGHT / 4, WIDTH / 2, HEIGHT / 2); @@ -70,27 +85,11 @@ draw (cairo_t *cr, int width, int height) cairo_set_source_rgb (cr2, 0, 0, 0); cairo_stroke (cr2); } + cairo_set_source_surface (cr, cairo_get_target (cr2), 0, 0); cairo_destroy (cr2); - /* Draw a translucent rectangle for reference where the rotated - * image should be. */ - cairo_new_path (cr); - cairo_rectangle (cr, WIDTH, HEIGHT, WIDTH, HEIGHT); - cairo_set_source_rgba (cr, 1, 1, 0, 0.3); - cairo_fill (cr); - -#if 1 /* Set to 0 to generate reference image */ - cairo_translate (cr, 2 * WIDTH, 2 * HEIGHT); - cairo_rotate (cr, M_PI); -#else - cairo_translate (cr, WIDTH, HEIGHT); -#endif - - cairo_set_source_surface (cr, stamp, 0, 0); cairo_paint (cr); - cairo_surface_destroy (stamp); - return CAIRO_TEST_SUCCESS; } |