summaryrefslogtreecommitdiffstatsci
path: root/src/cairo-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/cairo-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/cairo-tests/roundrect.cpp')
-rw-r--r--src/cairo-tests/roundrect.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/cairo-tests/roundrect.cpp b/src/cairo-tests/roundrect.cpp
index 45d1bb6..b40e915 100644
--- a/src/cairo-tests/roundrect.cpp
+++ b/src/cairo-tests/roundrect.cpp
@@ -44,7 +44,7 @@ int
ca_test_roundrect(caskbench_context_t *ctx)
{
int i;
- double line_width, x, y;
+ double line_width, x, y, radius;
cairo_t *cr = ctx->cairo_cr;
for (i=0; i<ctx->size; i++) {
@@ -52,12 +52,16 @@ ca_test_roundrect(caskbench_context_t *ctx)
x = 10 + trunc( (((double)ctx->canvas_width-20.0)*rand())/RAND_MAX );
y = 10 + trunc( (((double)ctx->canvas_height-20.0)*rand())/RAND_MAX );
+
+ /* vary radius upto half of MIN(X,Y) */
+ radius = (double)rand()/RAND_MAX * 20;
#if USE_CAIROGLES
- cairo_rounded_rectangle (cr, x, y, 100, 40, 4, 4, 4, 4);
+ cairo_rounded_rectangle (cr, x, y, 100, 40, radius, radius, radius, radius);
#else
- rounded_rectangle (cr, x, y, 100, 40, 4);
+ rounded_rectangle (cr, x, y, 100, 40, radius);
#endif
- line_width = trunc( ((double)ctx->size*rand())/RAND_MAX ) + 1;
+ /* 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);
cairo_set_line_width (cr, line_width);
cairo_stroke (cr);