diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-10-21 11:25:38 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-10-21 11:31:06 +0100 |
commit | 69415b4fc6387acda7498847f8181c802c8b0982 (patch) | |
tree | 9132e721f4e56a7cfb926b4008f57cce0beb804a | |
parent | 9ab296123ef49259a67e8dc43708023da2759283 (diff) |
[test/device-offset-scale] Propagate errors
Use cairo_get_target() to propagate errors from the secondary contexts.
-rw-r--r-- | test/device-offset-scale.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/device-offset-scale.c b/test/device-offset-scale.c index eabe15a76..7effebe34 100644 --- a/test/device-offset-scale.c +++ b/test/device-offset-scale.c @@ -41,16 +41,13 @@ static const cairo_test_t test = { static cairo_test_status_t draw (cairo_t *cr, int width, int height) { + cairo_surface_t *second; cairo_t *second_cr; - cairo_surface_t *second = cairo_image_surface_create (CAIRO_FORMAT_A8, 10, 10); /* fill with black so we don't need an rgb test case */ cairo_set_source_rgb (cr, 0, 0, 0); cairo_paint (cr); - /* adjust the offset so that the second rectangle will fit on the surface */ - cairo_surface_set_device_offset (second, -6, -6); - cairo_scale (cr, 0.5, 0.5); /* draw the first rectangle */ @@ -58,19 +55,22 @@ draw (cairo_t *cr, int width, int height) cairo_rectangle (cr, 6, 6, 10, 10); cairo_fill (cr); + /* adjust the offset so that the second rectangle will fit on the surface */ + second = cairo_image_surface_create (CAIRO_FORMAT_A8, 10, 10); + cairo_surface_set_device_offset (second, -6, -6); + /* draw the second rectangle: * this rectangle should end up in the same place as the rectangle above * independent of the device offset of the surface it is painted on*/ second_cr = cairo_create (second); + cairo_surface_destroy (second); cairo_rectangle (second_cr, 6, 6, 10, 10); cairo_fill (second_cr); /* paint the second rectangle on top of the first rectangle */ cairo_set_source_rgb (cr, 0.5, 0.5, 0); - cairo_mask_surface (cr, second, 0, 0); - + cairo_mask_surface (cr, cairo_get_target (second_cr), 0, 0); cairo_destroy (second_cr); - cairo_surface_destroy (second); return CAIRO_TEST_SUCCESS; } |