summaryrefslogtreecommitdiffstatsci
path: root/src/cairo-tests/fill.cpp
diff options
context:
space:
mode:
authorBryce Harrington <b.harrington@samsung.com>2014-05-07 18:06:33 -0700
committerBryce Harrington <b.harrington@samsung.com>2014-05-08 18:25:45 -0700
commit1fc5d699f9a64608bccc551f05414fc6c8daaee0 (patch)
tree38246849b1381229ea698edf255c7632d323b462 /src/cairo-tests/fill.cpp
parentb94133b60b20982251e34257fda0d0e70c7e3ed2 (diff)
fill: Refactor shape type determination
Diffstat (limited to 'src/cairo-tests/fill.cpp')
-rw-r--r--src/cairo-tests/fill.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/cairo-tests/fill.cpp b/src/cairo-tests/fill.cpp
index cea4e32..db930ef 100644
--- a/src/cairo-tests/fill.cpp
+++ b/src/cairo-tests/fill.cpp
@@ -122,9 +122,11 @@ void drawshapes(caskbench_context_t *ctx,kinetics_t *particles)
y = ctx->shape_args.center_y;
}
+ shape_type_t shape_type;
switch (shape) {
case 1:
// Circle
+ shape_type = CB_SHAPE_CIRCLE;
ctx->shape_args.center_x = x;
ctx->shape_args.center_y = y;
ctx->shape_args.radius = r;
@@ -146,11 +148,11 @@ void drawshapes(caskbench_context_t *ctx,kinetics_t *particles)
cairo_set_source (cr, pattern);
}
}
- cairoShapes[CB_SHAPE_CIRCLE](ctx,&ctx->shape_args);
break;
case 2:
// Rectangle
+ shape_type = CB_SHAPE_RECTANGLE;
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;
@@ -179,11 +181,11 @@ void drawshapes(caskbench_context_t *ctx,kinetics_t *particles)
cairo_set_source (cr, pattern);
}
}
- cairoShapes[CB_SHAPE_RECTANGLE](ctx,&ctx->shape_args);
break;
case 3:
// Triangle
+ shape_type = CB_SHAPE_TRIANGLE;
ctx->shape_args.numpoints = 3;
ctx->shape_args.points = (double (*)[2]) malloc(ctx->shape_args.numpoints*2*(sizeof(double)));
ctx->shape_args.points[0][0] = x;
@@ -211,11 +213,11 @@ void drawshapes(caskbench_context_t *ctx,kinetics_t *particles)
}
}
- cairoShapes[CB_SHAPE_TRIANGLE] (ctx,&ctx->shape_args);
break;
case 4:
// Star
+ shape_type = CB_SHAPE_STAR;
ctx->shape_args.numpoints = 10;
ctx->shape_args.points = (double (*)[2]) malloc(ctx->shape_args.numpoints*2*(sizeof(double)));
@@ -242,13 +244,16 @@ void drawshapes(caskbench_context_t *ctx,kinetics_t *particles)
cairo_set_source (cr, pattern);
}
}
- cairoShapes[CB_SHAPE_STAR] (ctx,&ctx->shape_args);
break;
default:
+ // TODO: Should never reach here
break;
}
+ cairoShapes[shape_type] (ctx,&ctx->shape_args);
+
+ // Reset
ctx->shape_args.width = old_width;
ctx->shape_args.height = old_height;
if (ctx->shape_args.points)