diff options
Diffstat (limited to 'WebCore/rendering/svg')
-rw-r--r-- | WebCore/rendering/svg/RenderSVGPath.cpp | 23 | ||||
-rw-r--r-- | WebCore/rendering/svg/SVGInlineTextBox.cpp | 10 | ||||
-rw-r--r-- | WebCore/rendering/svg/SVGInlineTextBox.h | 2 |
3 files changed, 19 insertions, 16 deletions
diff --git a/WebCore/rendering/svg/RenderSVGPath.cpp b/WebCore/rendering/svg/RenderSVGPath.cpp index 0c8ac0c..483303f 100644 --- a/WebCore/rendering/svg/RenderSVGPath.cpp +++ b/WebCore/rendering/svg/RenderSVGPath.cpp @@ -148,17 +148,19 @@ void RenderSVGPath::layout() void RenderSVGPath::fillAndStrokePath(GraphicsContext* context) { + context->beginPath(); RenderStyle* style = this->style(); Color fallbackColor; if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(this, style, fallbackColor)) { + context->addPath(m_path); if (fillPaintingResource->applyResource(this, style, context, ApplyToFillMode)) - fillPaintingResource->postApplyResource(this, context, ApplyToFillMode, &m_path); + fillPaintingResource->postApplyResource(this, context, ApplyToFillMode); else if (fallbackColor.isValid()) { RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource(); fallbackResource->setColor(fallbackColor); if (fallbackResource->applyResource(this, style, context, ApplyToFillMode)) - fallbackResource->postApplyResource(this, context, ApplyToFillMode, &m_path); + fallbackResource->postApplyResource(this, context, ApplyToFillMode); } } @@ -167,31 +169,30 @@ void RenderSVGPath::fillAndStrokePath(GraphicsContext* context) if (!strokePaintingResource) return; - Path path; - - bool nonScalingStroke = style->svgStyle()->vectorEffect() == VE_NON_SCALING_STROKE; bool restoreContext = false; - if (nonScalingStroke) { + if (style->svgStyle()->vectorEffect() == VE_NON_SCALING_STROKE) { SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(node()); AffineTransform nonScalingStrokeTransform = element->getScreenCTM(SVGLocatable::DisallowStyleUpdate); if (!nonScalingStrokeTransform.isInvertible()) return; - path = m_path; - path.transform(nonScalingStrokeTransform); + Path transformedPath = m_path; + transformedPath.transform(nonScalingStrokeTransform); context->save(); context->concatCTM(nonScalingStrokeTransform.inverse()); + context->addPath(transformedPath); restoreContext = true; - } + } else + context->addPath(m_path); if (strokePaintingResource->applyResource(this, style, context, ApplyToStrokeMode)) - strokePaintingResource->postApplyResource(this, context, ApplyToStrokeMode, nonScalingStroke ? &path : &m_path); + strokePaintingResource->postApplyResource(this, context, ApplyToStrokeMode); else if (fallbackColor.isValid()) { RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource(); fallbackResource->setColor(fallbackColor); if (fallbackResource->applyResource(this, style, context, ApplyToStrokeMode)) - fallbackResource->postApplyResource(this, context, ApplyToStrokeMode, nonScalingStroke ? &path : &m_path); + fallbackResource->postApplyResource(this, context, ApplyToStrokeMode); } if (restoreContext) diff --git a/WebCore/rendering/svg/SVGInlineTextBox.cpp b/WebCore/rendering/svg/SVGInlineTextBox.cpp index 5d0278b..d1f660a 100644 --- a/WebCore/rendering/svg/SVGInlineTextBox.cpp +++ b/WebCore/rendering/svg/SVGInlineTextBox.cpp @@ -318,14 +318,14 @@ bool SVGInlineTextBox::acquirePaintingResource(GraphicsContext*& context, Render return true; } -void SVGInlineTextBox::releasePaintingResource(GraphicsContext*& context, const Path* path) +void SVGInlineTextBox::releasePaintingResource(GraphicsContext*& context) { ASSERT(m_paintingResource); RenderObject* parentRenderer = parent()->renderer(); ASSERT(parentRenderer); - m_paintingResource->postApplyResource(parentRenderer, context, m_paintingResourceMode, path); + m_paintingResource->postApplyResource(parentRenderer, context, m_paintingResourceMode); m_paintingResource = 0; } @@ -344,7 +344,7 @@ bool SVGInlineTextBox::prepareGraphicsContextForTextPainting(GraphicsContext*& c void SVGInlineTextBox::restoreGraphicsContextAfterTextPainting(GraphicsContext*& context, TextRun& textRun) { - releasePaintingResource(context, /* path */0); + releasePaintingResource(context); #if ENABLE(SVG_FONTS) textRun.setActivePaintingResource(0); @@ -500,9 +500,11 @@ void SVGInlineTextBox::paintDecorationWithStyle(GraphicsContext* context, ETextD path.addRect(FloatRect(fragment.x, y, fragment.width, thickness)); context->save(); + context->beginPath(); + context->addPath(path); if (acquirePaintingResource(context, decorationRenderer, decorationStyle)) - releasePaintingResource(context, &path); + releasePaintingResource(context); context->restore(); } diff --git a/WebCore/rendering/svg/SVGInlineTextBox.h b/WebCore/rendering/svg/SVGInlineTextBox.h index acc5e9f..8e82dda 100644 --- a/WebCore/rendering/svg/SVGInlineTextBox.h +++ b/WebCore/rendering/svg/SVGInlineTextBox.h @@ -68,7 +68,7 @@ private: TextRun constructTextRun(RenderStyle*, const SVGTextFragment&) const; bool acquirePaintingResource(GraphicsContext*&, RenderObject*, RenderStyle*); - void releasePaintingResource(GraphicsContext*&, const Path*); + void releasePaintingResource(GraphicsContext*&); bool prepareGraphicsContextForTextPainting(GraphicsContext*&, TextRun&, RenderStyle*); void restoreGraphicsContextAfterTextPainting(GraphicsContext*&, TextRun&); |