diff options
| author | Bryce Harrington <b.harrington@samsung.com> | 2013-11-12 18:59:36 -0800 |
|---|---|---|
| committer | Bryce Harrington <b.harrington@samsung.com> | 2013-11-13 13:19:18 -0800 |
| commit | 5a0770ee6117c8b1f9cd9bf5820e8ae268fd09a2 (patch) | |
| tree | f664b830102e3406a1dbba37c8ad497c2d220696 /src/skia-tests/roundrect.cpp | |
| parent | 8eb35dc7db018b9187c30454604fcfd88a8dadca (diff) | |
Add a rounded rectangle stroking test
Diffstat (limited to 'src/skia-tests/roundrect.cpp')
| -rw-r--r-- | src/skia-tests/roundrect.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/skia-tests/roundrect.cpp b/src/skia-tests/roundrect.cpp new file mode 100644 index 0000000..42834c3 --- /dev/null +++ b/src/skia-tests/roundrect.cpp @@ -0,0 +1,40 @@ +// From http://www.atoker.com/blog/2008/09/06/skia-graphics-library-in-chrome-first-impressions/ + +#include "SkBitmap.h" +#include "SkBitmapDevice.h" +#include "SkPaint.h" +#include "SkRect.h" +#include <cairo.h> + +#include "caskbench.h" + +int +sk_setup_roundrect(caskbench_context_t *ctx) +{ + ctx->paint->setARGB(255, 255, 255, 255); + return 1; +} + +int +sk_test_roundrect(caskbench_context_t *ctx) +{ + int i, x, y, w; + SkRect rect; + + for (i=0; i<ctx->size; i++) { + ctx->paint->setColor(rand()); + w = ((double)ctx->size*rand())/RAND_MAX + 1; + x = ((double)800*rand())/RAND_MAX + 10; + y = ((double)300*rand())/RAND_MAX + 10; + rect.set(x, y, x+100, y+40); + ctx->paint->setStrokeWidth(w); + ctx->canvas->drawRoundRect(rect, 4.0, 4.0, *(ctx->paint)); + } + + return 1; +} + +void +sk_teardown_roundrect(void) +{ +} |