summaryrefslogtreecommitdiffstatsci
path: root/src/skia-tests/rect.cpp
diff options
context:
space:
mode:
authorBryce Harrington <b.harrington@samsung.com>2014-06-24 11:58:53 -0700
committerBryce Harrington <b.harrington@samsung.com>2014-06-24 17:23:21 -0700
commitfb506c0829135d4ac35d0fbbdc76f19c6a58ca21 (patch)
treebb1c68da62a2c4a413d8936b3592e0e4d6e740ef /src/skia-tests/rect.cpp
parent9dae77010a6efc5beb8b8b5cbe713c02494c87e0 (diff)
Add CB_FILL_RANDOM to select a random fill type
Also, make command line parsing of fill and shape types more strict
Diffstat (limited to 'src/skia-tests/rect.cpp')
-rw-r--r--src/skia-tests/rect.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/skia-tests/rect.cpp b/src/skia-tests/rect.cpp
index 42e59e0..efed0b3 100644
--- a/src/skia-tests/rect.cpp
+++ b/src/skia-tests/rect.cpp
@@ -17,7 +17,6 @@
#include "skia-shapes.h"
/* TODO:
- * - How to specify fill?
* - Specify with or without alpha
* - With or without antialiasing?
* - Stroke width should be via the shape defaults
@@ -29,15 +28,8 @@ sk_setup_rect(caskbench_context_t *ctx)
ctx->skia_paint->setAntiAlias(false);
ctx->skia_paint->setStrokeWidth(1);
- switch (ctx->shape_defaults.fill_type) {
- case CB_FILL_NONE:
- ctx->skia_paint->setStyle(SkPaint::kStroke_Style);
- break;
- case CB_FILL_SOLID:
- ctx->skia_paint->setStyle(SkPaint::kFill_Style);
- break;
- default:
- break;
+ if (ctx->shape_defaults.fill_type != CB_FILL_RANDOM) {
+ sk_set_fill_style(ctx, ctx->shape_defaults.fill_type);
}
return 1;
@@ -67,6 +59,10 @@ sk_test_rect(caskbench_context_t *ctx)
shape.width = abs(x2 - x1);
shape.height = abs(y2 - y1);
+ if (shape.fill_type == CB_FILL_RANDOM) {
+ sk_set_fill_style(ctx, generate_random_fill_type());
+ }
+
skiaRandomizePaintColor(ctx);
skiaDrawRectangle(ctx, &shape);
}