diff options
| author | suyambulingamrm <suyambu.rm@samsung.com> | 2014-07-31 20:21:17 +0530 |
|---|---|---|
| committer | suyambulingamrm <suyambu.rm@samsung.com> | 2014-07-31 20:21:17 +0530 |
| commit | b9e241dc6678d0beb6a49a07781c7375448c1e0f (patch) | |
| tree | f94221137c94595f8441254ef9888c0b442dd764 | |
| parent | 92af0cbe996ee6036c19c7f1947fe11bb499c7ba (diff) | |
Issue #102. Fix output discrepancy observed in image-rotate test.
| -rw-r--r-- | src/cairo-tests/image-rotate.cpp | 17 | ||||
| -rw-r--r-- | src/skia-tests/image-rotate.cpp | 10 |
2 files changed, 11 insertions, 16 deletions
diff --git a/src/cairo-tests/image-rotate.cpp b/src/cairo-tests/image-rotate.cpp index 2563d9c..4acc2b4 100644 --- a/src/cairo-tests/image-rotate.cpp +++ b/src/cairo-tests/image-rotate.cpp @@ -5,9 +5,6 @@ * specified in the COPYING file included with this source code. */ #include <config.h> - -#include <stdio.h> -#include <stdlib.h> #include <cairo.h> #include "caskbench.h" @@ -36,6 +33,8 @@ int ca_test_image_rotate(caskbench_context_t* ctx) { cairo_t *cr = ctx->cairo_cr; + static int counter = 0; + double radian = 0; int w = ctx->canvas_width; int h = ctx->canvas_height; int iw = cairo_image_surface_get_width (image); @@ -44,7 +43,6 @@ ca_test_image_rotate(caskbench_context_t* ctx) 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; @@ -52,15 +50,14 @@ ca_test_image_rotate(caskbench_context_t* ctx) cairo_new_path(cr); cairo_save(cr); cairo_translate(cr, w/2, h/2); - cairo_rotate(cr, i / 50.0); // TODO: Original rotates by counter/50 + + radian = (1/57.29) * (counter/50); + cairo_rotate(cr, radian); + cairo_translate(cr, -iw/2, -ih/2); cairo_set_source_surface (cr, cached_image, 0, 0); -#if 1 cairo_paint (cr); -#else - cairo_rectangle(cr, 0, 0, iw, ih); - cairo_fill(cr); -#endif + counter++; cairo_restore(cr); } diff --git a/src/skia-tests/image-rotate.cpp b/src/skia-tests/image-rotate.cpp index 2191dee..612dd76 100644 --- a/src/skia-tests/image-rotate.cpp +++ b/src/skia-tests/image-rotate.cpp @@ -6,11 +6,6 @@ */ #include <config.h> -#include <SkCanvas.h> -#include <SkPaint.h> -#include <SkBitmap.h> -#include <SkBitmapDevice.h> - #include "caskbench.h" #include "caskbench_context.h" #include "skia-shapes.h" @@ -32,6 +27,7 @@ sk_teardown_image_rotate(void) int sk_test_image_rotate(caskbench_context_t *ctx) { + static int counter = 0; int w = ctx->canvas_width; int h = ctx->canvas_height; int iw = bitmap.width(); @@ -45,10 +41,12 @@ sk_test_image_rotate(caskbench_context_t *ctx) ctx->skia_canvas->save(); ctx->skia_canvas->translate(w/2, h/2); - ctx->skia_canvas->rotate(i / 50.0); // TODO: Original rotates by counter/50 + ctx->skia_canvas->rotate(SkDoubleToScalar(counter/(50.0))); ctx->skia_canvas->translate(-iw/2, -ih/2); + ctx->skia_canvas->drawBitmap(bitmap, 0, 0); ctx->skia_canvas->restore(); + counter++; } return 1; |