[cairo-commit] test/meta-surface-pattern.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Oct 21 16:04:23 PDT 2008


 test/meta-surface-pattern.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit b2cbbceb4ca57816a498c2c1e676b19182c34e12
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Oct 21 19:44:42 2008 +0100

    [test/meta-surface-pattern] Propagate errors.
    
    Use cairo_get_target() to propagate any errors from the secondary context.

diff --git a/test/meta-surface-pattern.c b/test/meta-surface-pattern.c
index 58f05b4..0eea61d 100644
--- a/test/meta-surface-pattern.c
+++ b/test/meta-surface-pattern.c
@@ -60,8 +60,8 @@ draw (cairo_t *cr, int width, int height)
     pat_surface = cairo_surface_create_similar (cairo_get_group_target (cr),
 						CAIRO_CONTENT_COLOR_ALPHA,
 						PAT_WIDTH, PAT_HEIGHT);
-
     cr2 = cairo_create (pat_surface);
+    cairo_surface_destroy (pat_surface);
 
     cairo_set_source_rgba (cr2, 1, 0, 1, 0.5);
     cairo_rectangle (cr2, PAT_WIDTH/6.0, PAT_HEIGHT/6.0, PAT_WIDTH/4.0, PAT_HEIGHT/4.0);
@@ -104,9 +104,8 @@ draw (cairo_t *cr, int width, int height)
     cairo_line_to (cr2, PAT_WIDTH/4.0, PAT_WIDTH);
     cairo_stroke (cr2);
 
+    pattern = cairo_pattern_create_for_surface (cairo_get_target (cr2));
     cairo_destroy (cr2);
-    pattern = cairo_pattern_create_for_surface (pat_surface);
-    cairo_surface_destroy (pat_surface);
 
     cairo_matrix_init_identity (&mat);
     cairo_matrix_scale (&mat, 2, 1.5);


More information about the cairo-commit mailing list