summaryrefslogtreecommitdiffstatsci
path: root/src/cairo-shapes.cpp
diff options
context:
space:
mode:
authorsuyambulingamrm <suyambu.rm@samsung.com>2014-06-02 12:17:03 +0530
committersuyambulingamrm <suyambu.rm@samsung.com>2014-06-02 12:17:03 +0530
commit1bf0046da7b1c3f48f89764e328b0f7e27aff6c8 (patch)
tree63627929cc11527df275456af59c199a0a02f6c4 /src/cairo-shapes.cpp
parentb3a8c05c2a4d12e161836f43831fb3f70f0730ae (diff)
Issue #36. RGB Color string parsing.
Ref: https://github.com/Samsung/caskbench/issues/36
Diffstat (limited to 'src/cairo-shapes.cpp')
-rw-r--r--src/cairo-shapes.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/cairo-shapes.cpp b/src/cairo-shapes.cpp
index 01403c6..b850bf2 100644
--- a/src/cairo-shapes.cpp
+++ b/src/cairo-shapes.cpp
@@ -204,13 +204,12 @@ cairoDrawRandomizedShape(caskbench_context_t *ctx, shapes_t *shape)
case CB_FILL_NONE:
case CB_FILL_SOLID:
default:
- if (shape->red > 0 || shape->blue > 0 || shape->green > 0 || shape->alpha > 0)
- {
- cairo_set_source_rgba(ctx->cairo_cr,
- shape->red ? (double)shape->red : 0.0,
- shape->green ? (double)shape->green : 0.0,
- shape->blue ? (double)shape->blue : 0.0,
- shape->alpha ? (double)shape->alpha : 1.0 );
+ if (shape->fill_color != -1) {
+ cairo_set_source_rgba (ctx->cairo_cr,
+ ((shape->fill_color >> 24) & 255) / 255.0,
+ ((shape->fill_color >> 16) & 255) / 255.0,
+ ((shape->fill_color >> 8) & 255) / 255.0,
+ ((shape->fill_color) & 255) / 255.0);
}
else {
cairoRandomizeColor(ctx);
@@ -240,12 +239,11 @@ cairoDrawRandomizedShape(caskbench_context_t *ctx, shapes_t *shape)
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)
- {
+ if (shape->stroke_color != -1) {
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);
+ ((shape->stroke_color >> 24) & 255) / 255.0,
+ ((shape->stroke_color >> 16) & 255) / 255.0,
+ ((shape->stroke_color >> 8) & 255) / 255.0);
}
else {
cairoRandomizeColor (ctx);