diff options
Diffstat (limited to 'test/mask.c')
-rw-r--r-- | test/mask.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/mask.c b/test/mask.c index bc1adfdb..451054e3 100644 --- a/test/mask.c +++ b/test/mask.c @@ -33,6 +33,7 @@ #define PAD 2 static const char *png_filename = "romedalen.png"; +static cairo_surface_t *image; static void set_solid_pattern (const cairo_test_context_t *ctx, cairo_t *cr, int x, int y) @@ -64,7 +65,13 @@ set_image_pattern (const cairo_test_context_t *ctx, cairo_t *cr, int x, int y) { cairo_pattern_t *pattern; - pattern = cairo_test_create_pattern_from_png (ctx, png_filename); + if (image == NULL || cairo_surface_status (image)) { + cairo_surface_destroy (image); + image = cairo_test_create_surface_from_png (ctx, png_filename); + } + + pattern = cairo_pattern_create_for_surface (image); + cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT); cairo_set_source (cr, pattern); cairo_pattern_destroy (pattern); } @@ -225,6 +232,9 @@ draw (cairo_t *cr, int width, int height) cairo_destroy (cr2); + cairo_surface_destroy (image); + image = NULL; + return CAIRO_TEST_SUCCESS; } |