From 80e178b1ff37e67d7067e91e5ed35a3c163e6c1d Mon Sep 17 00:00:00 2001 From: suyambulingamrm Date: Thu, 3 Jul 2014 14:35:02 +0530 Subject: Issue #104. Adapt cairo tests to cache image surface. --- src/cairo-tests/clip.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/cairo-tests/clip.cpp') diff --git a/src/cairo-tests/clip.cpp b/src/cairo-tests/clip.cpp index 1a88941..680d29d 100644 --- a/src/cairo-tests/clip.cpp +++ b/src/cairo-tests/clip.cpp @@ -14,16 +14,20 @@ #include "cairo-shapes.h" static cairo_surface_t *image; +static cairo_surface_t *cached_image; int ca_setup_clip(caskbench_context_t *ctx) { image = cairoCreateSampleImage (ctx); + cached_image = cairoCacheImageSurface (ctx, image); return 1; } void ca_teardown_clip(void) { + cairo_surface_destroy (image); + cairo_surface_destroy (cached_image); } #if 1 @@ -69,7 +73,7 @@ ca_test_clip(caskbench_context_t *ctx) double x2 = (double)rand()/RAND_MAX * w; double y1 = (double)rand()/RAND_MAX * h; double y2 = (double)rand()/RAND_MAX * h; - cairo_set_source_surface (cr, image, x1, y1); + cairo_set_source_surface (cr, cached_image, x1, y1); // To scale without blur cairo_pattern_set_filter(cairo_get_source(cr), CAIRO_FILTER_FAST); cairo_paint (cr); -- cgit v1.3.1-4-g156e