diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:05:15 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:05:15 -0800 |
commit | 1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353 (patch) | |
tree | 4457a7306ea5acb43fe05bfe0973b1f7faf97ba2 /WebCore/svg/graphics/cairo/SVGPaintServerSolidCairo.cpp | |
parent | 9364f22aed35e1a1e9d07c121510f80be3ab0502 (diff) | |
download | external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.zip external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.gz external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.bz2 |
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'WebCore/svg/graphics/cairo/SVGPaintServerSolidCairo.cpp')
-rw-r--r-- | WebCore/svg/graphics/cairo/SVGPaintServerSolidCairo.cpp | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/WebCore/svg/graphics/cairo/SVGPaintServerSolidCairo.cpp b/WebCore/svg/graphics/cairo/SVGPaintServerSolidCairo.cpp index 6acc9b2..49e6f55 100644 --- a/WebCore/svg/graphics/cairo/SVGPaintServerSolidCairo.cpp +++ b/WebCore/svg/graphics/cairo/SVGPaintServerSolidCairo.cpp @@ -31,35 +31,22 @@ namespace WebCore { bool SVGPaintServerSolid::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const { // TODO: share this code with other PaintServers - cairo_t* cr = context->platformContext(); - const SVGRenderStyle* style = object->style()->svgStyle(); + + const SVGRenderStyle* svgStyle = object->style()->svgStyle(); + RenderStyle* style = object->style(); float red, green, blue, alpha; color().getRGBA(red, green, blue, alpha); - if ((type & ApplyToFillTargetType) && style->hasFill()) { - alpha = style->fillOpacity(); - - cairo_set_fill_rule(cr, style->fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING); + if ((type & ApplyToFillTargetType) && svgStyle->hasFill()) { + alpha = svgStyle->fillOpacity(); + context->setFillRule(svgStyle->fillRule()); } - if ((type & ApplyToStrokeTargetType) && style->hasStroke()) { - alpha = style->strokeOpacity(); - - cairo_set_line_width(cr, SVGRenderStyle::cssPrimitiveToLength(object, style->strokeWidth(), 1.0)); - context->setLineCap(style->capStyle()); - context->setLineJoin(style->joinStyle()); - if (style->joinStyle() == MiterJoin) - context->setMiterLimit(style->strokeMiterLimit()); - - const DashArray& dashes = dashArrayFromRenderingStyle(object->style()); - double* dsh = new double[dashes.size()]; - for (unsigned i = 0 ; i < dashes.size() ; i++) - dsh[i] = dashes[i]; - double dashOffset = SVGRenderStyle::cssPrimitiveToLength(object, style->strokeDashOffset(), 0.0); - cairo_set_dash(cr, dsh, dashes.size(), dashOffset); - delete[] dsh; + if ((type & ApplyToStrokeTargetType) && svgStyle->hasStroke()) { + alpha = svgStyle->strokeOpacity(); + applyStrokeStyleToContext(context, style, object); } cairo_set_source_rgba(cr, red, green, blue, alpha); |