diff options
| author | suyambulingamrm <suyambu.rm@samsung.com> | 2014-05-27 19:51:07 +0530 |
|---|---|---|
| committer | suyambulingamrm <suyambu.rm@samsung.com> | 2014-05-27 19:51:07 +0530 |
| commit | cdef3d98a2e713644c972ebc7ba756f25b57efdc (patch) | |
| tree | 97fc5d67912c09fa45a8a07953a638e18f46847a /src/cairo-shapes.cpp | |
| parent | 6c08b72c36630182401453f5c9e338cf23489382 (diff) | |
Stroke settings are updated properly in cairo and skia shapes file.
Diffstat (limited to 'src/cairo-shapes.cpp')
| -rw-r--r-- | src/cairo-shapes.cpp | 50 |
1 files changed, 36 insertions, 14 deletions
diff --git a/src/cairo-shapes.cpp b/src/cairo-shapes.cpp index 6905d1f..5016909 100644 --- a/src/cairo-shapes.cpp +++ b/src/cairo-shapes.cpp @@ -143,6 +143,7 @@ cairoDrawRandomizedShape(caskbench_context_t *ctx, shapes_t *shape) { cairo_pattern_t *pattern = NULL; cairo_surface_t *image = NULL; + cairo_path_t *new_path = NULL; static const double dashed3[] = {1.0}; static const double dashed2[] = {14.0, 6.0}; @@ -151,18 +152,6 @@ cairoDrawRandomizedShape(caskbench_context_t *ctx, shapes_t *shape) if (shape->shape_type == CB_SHAPE_NONE) shape->shape_type = generate_random_shape(); - // Stroke styles - if (shape->stroke_width) - { - cairo_set_line_width(ctx->cairo_cr, shape->stroke_width); - cairo_set_line_join(ctx->cairo_cr, (cairo_line_join_t)shape->join_style); - cairo_set_line_cap(ctx->cairo_cr, (cairo_line_cap_t)shape->cap_style); - if (shape->dash_style == 1) - cairo_set_dash(ctx->cairo_cr, dashed3, 1, 0); - else if (shape->dash_style == 2) - cairo_set_dash(ctx->cairo_cr, dashed2, 2, 0); - } - // Options for fill, gradient, and transparency switch (shape->fill_type) { case CB_FILL_IMAGE_PATTERN: @@ -191,8 +180,41 @@ cairoDrawRandomizedShape(caskbench_context_t *ctx, shapes_t *shape) break; } - // Draw - cairoShapes[shape->shape_type] (ctx, shape); + if (pattern) + cairo_set_source (ctx->cairo_cr, pattern); + + // Draw + cairoShapes[shape->shape_type-1] (ctx, shape); + new_path = cairo_copy_path(ctx->cairo_cr); + cairo_fill (ctx->cairo_cr); + + // Stroke styles + if (shape->stroke_width) + { + cairo_new_path (ctx->cairo_cr); + cairo_append_path (ctx->cairo_cr, new_path); + + cairo_set_line_width (ctx->cairo_cr, shape->stroke_width); + cairo_set_line_join (ctx->cairo_cr, (cairo_line_join_t)shape->join_style); + cairo_set_line_cap (ctx->cairo_cr, (cairo_line_cap_t)shape->cap_style); + if (shape->dash_style == 0) + cairo_set_dash (ctx->cairo_cr, dashed3, 1, 0); + else if (shape->dash_style == 1) + cairo_set_dash (ctx->cairo_cr, dashed2, 2, 0); + + if (shape->stroke_red > 0 || shape->stroke_blue > 0 || shape->stroke_green > 0) + { + cairo_set_source_rgb (ctx->cairo_cr, + shape->stroke_red ? (double)shape->stroke_red : 0.0, + shape->stroke_green ? (double)shape->stroke_green : 0.0, + shape->stroke_blue ? (double)shape->stroke_blue : 0.0); + } + else { + cairoRandomizeColor (ctx); + } + + cairo_stroke (ctx->cairo_cr); + } // Cleanup if (pattern != NULL) |