summaryrefslogtreecommitdiffstatsci
path: root/src/skia-tests/roundrect.cpp
diff options
context:
space:
mode:
authorsuyambulingamrm <suyambu.rm@samsung.com>2014-05-08 19:22:14 +0530
committerBryce Harrington <b.harrington@samsung.com>2014-05-08 19:16:41 -0700
commit34d7c6bd273ae760c77cd423b99c0fbd46d00fca (patch)
treef33a3d3e4e027d189e02de3c09e055ddb0f544aa /src/skia-tests/roundrect.cpp
parentf639a346569d01f36303b78d81e8ab9559657bf2 (diff)
roundrect: stroke width must not exceed twice of radius
This limitation is due to a Skia limitation. See: https://github.com/Samsung/skia/issues/4
Diffstat (limited to 'src/skia-tests/roundrect.cpp')
-rw-r--r--src/skia-tests/roundrect.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/skia-tests/roundrect.cpp b/src/skia-tests/roundrect.cpp
index e3aba75..722c95a 100644
--- a/src/skia-tests/roundrect.cpp
+++ b/src/skia-tests/roundrect.cpp
@@ -32,7 +32,7 @@ int
sk_test_roundrect(caskbench_context_t *ctx)
{
int i;
- double line_width, x, y;
+ double line_width, x, y, radius;
SkRect rect;
for (i=0; i<ctx->size; i++) {
@@ -42,10 +42,13 @@ sk_test_roundrect(caskbench_context_t *ctx)
y = trunc( (((double)ctx->canvas_height-20)*rand())/RAND_MAX ) + 10;
rect.set(x, y, x+100, y+40);
- line_width = trunc( ((double)ctx->size*rand())/RAND_MAX ) + 1;
- ctx->skia_paint->setStrokeWidth(line_width);
+ /* vary radius upto half of MIN(X,Y) */
+ radius = (double)rand()/RAND_MAX * 20;
- ctx->skia_canvas->drawRoundRect(rect, 4.0, 4.0, *(ctx->skia_paint));
+ /* line_width cannot be more than twice of radius due to skia limitation - Issue #4 in skia https://github.com/Samsung/skia/issues/4 */
+ line_width = (double)rand()/RAND_MAX * (2*radius);
+ ctx->skia_paint->setStrokeWidth(line_width);
+ ctx->skia_canvas->drawRoundRect(rect, radius, radius, *(ctx->skia_paint));
}
return 1;