From 9ab296123ef49259a67e8dc43708023da2759283 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 21 Oct 2008 11:14:01 +0100 Subject: [PATCH] [test/device-offset-positive] Propagate errors. Use cairo_get_target() to propagate errors from the secondary context. --- test/device-offset-positive.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/test/device-offset-positive.c b/test/device-offset-positive.c index 4b49b1006..082f3d7ac 100644 --- a/test/device-offset-positive.c +++ b/test/device-offset-positive.c @@ -64,23 +64,21 @@ draw (cairo_t *cr, int width, int height) cairo_surface_get_content (target), SIZE / 2, SIZE / 2); cr2 = cairo_create (surface); + cairo_surface_destroy (surface); cairo_set_source_rgb (cr2, 1, 0, 0); /* red */ draw_square (cr2); - cairo_destroy (cr2); - - cairo_surface_set_device_offset (surface, + SIZE / 2, + SIZE / 2); - /* Finally, copy the offset surface to the original destination. - * The final result should be a blue square with the upper-left - * quarter red. */ + * The final result should be a blue square with the upper-left + * quarter red. */ + surface = cairo_surface_reference (cairo_get_target (cr2)); + cairo_destroy (cr2); + cairo_surface_set_device_offset (surface, + SIZE / 2, + SIZE / 2); cairo_set_source_surface (cr, surface, SIZE / 2, SIZE / 2); cairo_paint (cr); - cairo_surface_destroy (surface); - return CAIRO_TEST_SUCCESS; }