diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/cairo-tests/image-rotate.cpp | 6 | ||||
| -rw-r--r-- | src/cairo-tests/image-scale.cpp | 12 | ||||
| -rw-r--r-- | src/cairo-tests/image.cpp | 7 |
3 files changed, 23 insertions, 2 deletions
diff --git a/src/cairo-tests/image-rotate.cpp b/src/cairo-tests/image-rotate.cpp index e56d706..68da107 100644 --- a/src/cairo-tests/image-rotate.cpp +++ b/src/cairo-tests/image-rotate.cpp @@ -69,7 +69,13 @@ ca_test_image_rotate(caskbench_context_t* ctx) cairo_rotate(cr, i / 50.0); // TODO: Original rotates by counter/50 cairo_translate(cr, -iw/2, -ih/2); cairo_set_source_surface (cr, image, 0, 0); +#if 1 cairo_paint (cr); +#else + cairo_rectangle(cr, 0, 0, iw, ih); + cairo_fill(cr); +#endif + cairo_restore(cr); } diff --git a/src/cairo-tests/image-scale.cpp b/src/cairo-tests/image-scale.cpp index 120577c..0747c37 100644 --- a/src/cairo-tests/image-scale.cpp +++ b/src/cairo-tests/image-scale.cpp @@ -66,14 +66,22 @@ ca_test_image_scale(caskbench_context_t *ctx) double y = MIN(y1, y2); double width_ratio = float(fabs(x2 - x1)) / float(iw); double height_ratio = float(fabs(y2 - y1)) / float(ih); - double scale_xy = MIN(height_ratio, width_ratio); cairo_save(cr); cairo_translate(cr,x,y); - cairo_scale(cr,scale_xy, scale_xy); + cairo_scale(cr, width_ratio, height_ratio); cairo_set_source_surface (cr, image, 0, 0); + // Scale without blur + cairo_pattern_set_filter (cairo_get_source(cr), CAIRO_FILTER_FAST); +#if 1 + // Paint method cairo_paint (cr); +#else + // Fill Method + cairo_rectangle(cr, 0, 0, iw, ih); + cairo_fill(cr); +#endif cairo_restore(cr); } return 1; diff --git a/src/cairo-tests/image.cpp b/src/cairo-tests/image.cpp index cbf4c78..cdb5348 100644 --- a/src/cairo-tests/image.cpp +++ b/src/cairo-tests/image.cpp @@ -62,7 +62,14 @@ ca_test_image(caskbench_context_t* ctx) double x = (double)rand()/RAND_MAX * pw; double y = (double)rand()/RAND_MAX * ph; cairo_set_source_surface (cr, image, x, y); +#if 1 cairo_paint (cr); +#else + // Fill Method + cairo_rectangle(cr, x, y, iw, ih); + cairo_fill(cr); +#endif + } return 1; } |