summaryrefslogtreecommitdiffstatsci
path: root/src/cairo-tests/fill.cpp
diff options
context:
space:
mode:
authorBryce Harrington <b.harrington@samsung.com>2014-05-07 16:32:23 -0700
committerBryce Harrington <b.harrington@samsung.com>2014-05-08 18:25:45 -0700
commitb94133b60b20982251e34257fda0d0e70c7e3ed2 (patch)
tree3f2302bcd703f434724f0f70e9c5f2481d6550d9 /src/cairo-tests/fill.cpp
parent0ebcdac4b90fb094790f07d3a196ecd06dd5674d (diff)
fill: Factor out reset of point structure and widths from case statement
Diffstat (limited to 'src/cairo-tests/fill.cpp')
-rw-r--r--src/cairo-tests/fill.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/cairo-tests/fill.cpp b/src/cairo-tests/fill.cpp
index 516b064..cea4e32 100644
--- a/src/cairo-tests/fill.cpp
+++ b/src/cairo-tests/fill.cpp
@@ -128,6 +128,7 @@ void drawshapes(caskbench_context_t *ctx,kinetics_t *particles)
ctx->shape_args.center_x = x;
ctx->shape_args.center_y = y;
ctx->shape_args.radius = r;
+ ctx->shape_args.points = NULL;
if(ctx->shape_args.fill_type != NULL)
{
@@ -146,7 +147,6 @@ void drawshapes(caskbench_context_t *ctx,kinetics_t *particles)
}
}
cairoShapes[CB_SHAPE_CIRCLE](ctx,&ctx->shape_args);
-
break;
case 2:
@@ -155,6 +155,7 @@ void drawshapes(caskbench_context_t *ctx,kinetics_t *particles)
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;
+ ctx->shape_args.points = NULL;
if(ctx->shape_args.fill_type != NULL)
{
@@ -179,7 +180,6 @@ void drawshapes(caskbench_context_t *ctx,kinetics_t *particles)
}
}
cairoShapes[CB_SHAPE_RECTANGLE](ctx,&ctx->shape_args);
-
break;
case 3:
@@ -212,8 +212,6 @@ void drawshapes(caskbench_context_t *ctx,kinetics_t *particles)
}
cairoShapes[CB_SHAPE_TRIANGLE] (ctx,&ctx->shape_args);
- free (ctx->shape_args.points);
-
break;
case 4:
@@ -245,13 +243,17 @@ void drawshapes(caskbench_context_t *ctx,kinetics_t *particles)
}
}
cairoShapes[CB_SHAPE_STAR] (ctx,&ctx->shape_args);
-
- free (ctx->shape_args.points);
break;
default:
break;
}
+
+ ctx->shape_args.width = old_width;
+ ctx->shape_args.height = old_height;
+ if (ctx->shape_args.points)
+ free (ctx->shape_args.points);
+
newPath = cairo_copy_path(cr);
cairo_fill (cr);
if(ctx->shape_args.stroke_width)