summaryrefslogtreecommitdiffstatsci
path: root/src/cairo-tests/fill.cpp
diff options
context:
space:
mode:
authorBryce Harrington <b.harrington@samsung.com>2014-05-07 16:07:38 -0700
committerBryce Harrington <b.harrington@samsung.com>2014-05-08 18:25:45 -0700
commit0ebcdac4b90fb094790f07d3a196ecd06dd5674d (patch)
tree8fe0bd828a7dc60cb22981148b31f4cbef350726 /src/cairo-tests/fill.cpp
parentd7c44f73d33081aac477119ee7d8d4e098f29699 (diff)
fill: Refactor x,y center point selection out of case statements
Diffstat (limited to 'src/cairo-tests/fill.cpp')
-rw-r--r--src/cairo-tests/fill.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/cairo-tests/fill.cpp b/src/cairo-tests/fill.cpp
index af57da7..516b064 100644
--- a/src/cairo-tests/fill.cpp
+++ b/src/cairo-tests/fill.cpp
@@ -117,11 +117,16 @@ void drawshapes(caskbench_context_t *ctx,kinetics_t *particles)
}
+ if (!ctx->shape_args.multi_shapes && !ctx->shape_args.animation) {
+ x = ctx->shape_args.center_x;
+ y = ctx->shape_args.center_y;
+ }
+
switch (shape) {
case 1:
// Circle
- ctx->shape_args.center_x = (ctx->shape_args.multi_shapes || ctx->shape_args.animation)?x+r:ctx->shape_args.center_x;
- ctx->shape_args.center_y = (ctx->shape_args.multi_shapes || ctx->shape_args.animation)?y+r:ctx->shape_args.center_y;
+ ctx->shape_args.center_x = x;
+ ctx->shape_args.center_y = y;
ctx->shape_args.radius = r;
if(ctx->shape_args.fill_type != NULL)
@@ -146,8 +151,8 @@ void drawshapes(caskbench_context_t *ctx,kinetics_t *particles)
case 2:
// Rectangle
- ctx->shape_args.center_x = (ctx->shape_args.multi_shapes || ctx->shape_args.animation)?x:ctx->shape_args.center_x;
- ctx->shape_args.center_y = (ctx->shape_args.multi_shapes|| ctx->shape_args.animation)?y:ctx->shape_args.center_y;
+ ctx->shape_args.center_x = x;
+ ctx->shape_args.center_y = y;
ctx->shape_args.width = (ctx->shape_args.width)?ctx->shape_args.width:2*r;
ctx->shape_args.height = (ctx->shape_args.height)?ctx->shape_args.height:2*r;
@@ -180,11 +185,6 @@ void drawshapes(caskbench_context_t *ctx,kinetics_t *particles)
case 3:
// Triangle
ctx->shape_args.numpoints = 3;
- if( (!ctx->shape_args.multi_shapes && !ctx->shape_args.animation))
- {
- x = ctx->shape_args.center_x;
- y = ctx->shape_args.center_y;
- }
ctx->shape_args.points = (double (*)[2]) malloc(ctx->shape_args.numpoints*2*(sizeof(double)));
ctx->shape_args.points[0][0] = x;
ctx->shape_args.points[0][1] = y+2*r;
@@ -218,11 +218,6 @@ void drawshapes(caskbench_context_t *ctx,kinetics_t *particles)
case 4:
// Star
- if ((!ctx->shape_args.multi_shapes && !ctx->shape_args.animation))
- {
- x = ctx->shape_args.center_x;
- y = ctx->shape_args.center_y;
- }
ctx->shape_args.numpoints = 10;
ctx->shape_args.points = (double (*)[2]) malloc(ctx->shape_args.numpoints*2*(sizeof(double)));