diff options
| author | suyambulingamrm <suyambu.rm@samsung.com> | 2014-06-16 19:56:14 +0530 |
|---|---|---|
| committer | Bryce Harrington <b.harrington@samsung.com> | 2014-06-17 18:14:40 -0700 |
| commit | 24ffa581988aadccf9e5c46a8569056b2b58ed10 (patch) | |
| tree | 5626bbf33523604df9530135b877f5e3e2928f2b /src/cairo-tests/image.cpp | |
| parent | bf441088356830159b7a1fa9ca7ee1f00688e43d (diff) | |
Issue #92. New tests for cairo.
Diffstat (limited to 'src/cairo-tests/image.cpp')
| -rw-r--r-- | src/cairo-tests/image.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/cairo-tests/image.cpp b/src/cairo-tests/image.cpp index aba77d7..cbf4c78 100644 --- a/src/cairo-tests/image.cpp +++ b/src/cairo-tests/image.cpp @@ -49,12 +49,18 @@ ca_teardown_image(void) int ca_test_image(caskbench_context_t* ctx) { - int i, x, y; cairo_t *cr = ctx->cairo_cr; - for (i=0; i<ctx->size; i++) { - y = 50 * (int)(i/4); - x = 200 * (i%4); + int w = ctx->canvas_width; + int h = ctx->canvas_height; + int iw = cairo_image_surface_get_width (image); + int ih = cairo_image_surface_get_height (image); + int pw = w - iw; + int ph = h - ih; + + for (int i=0; i<ctx->size; i++) { + double x = (double)rand()/RAND_MAX * pw; + double y = (double)rand()/RAND_MAX * ph; cairo_set_source_surface (cr, image, x, y); cairo_paint (cr); } |