Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1356)

Unified Diff: Source/core/paint/SVGShapePainter.cpp

Issue 1070703002: Explicitly use SkPaint(s) in SVGInlineTextBoxPainter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/paint/SVGShapePainter.cpp
diff --git a/Source/core/paint/SVGShapePainter.cpp b/Source/core/paint/SVGShapePainter.cpp
index 22b0e3aa083cf46cd58c977e666f694270b38968..a8ba1a508ce3b3479b8b425444e9cc104570ab30 100644
--- a/Source/core/paint/SVGShapePainter.cpp
+++ b/Source/core/paint/SVGShapePainter.cpp
@@ -35,43 +35,6 @@ static bool setupNonScalingStrokeContext(AffineTransform& strokeTransform, Graph
return true;
}
-static bool paintForLayoutObject(const PaintInfo& paintInfo, const ComputedStyle& style, LayoutObject& layoutObject, LayoutSVGResourceMode resourceMode, SkPaint& paint, const AffineTransform* additionalPaintServerTransform = nullptr)
-{
- if (paintInfo.isRenderingClipPathAsMaskImage()) {
- if (resourceMode == ApplyToStrokeMode)
- return false;
- paint.setColor(SVGComputedStyle::initialFillPaintColor().rgb());
- paint.setShader(nullptr);
- return true;
- }
-
- SVGPaintServer paintServer = SVGPaintServer::requestForLayoutObject(layoutObject, style, resourceMode);
- if (!paintServer.isValid())
- return false;
-
- if (additionalPaintServerTransform && paintServer.isTransformDependent())
- paintServer.prependTransform(*additionalPaintServerTransform);
-
- const SVGComputedStyle& svgStyle = style.svgStyle();
- float paintAlpha = resourceMode == ApplyToFillMode ? svgStyle.fillOpacity() : svgStyle.strokeOpacity();
- paintServer.applyToSkPaint(paint, paintAlpha);
-
- paint.setFilterQuality(WebCoreInterpolationQualityToSkFilterQuality(InterpolationDefault));
-
- // TODO(fs): The color filter can set when generating a picture for a mask -
- // due to color-interpolation. We could also just apply the
- // color-interpolation property from the the shape itself (which could mean
- // the paintserver if it has it specified), since that would be more in line
- // with the spec for color-interpolation. For now, just steal it from the GC
- // though.
- // Additionally, it's not really safe/guaranteed to be correct, as
- // something down the paint pipe may want to farther tweak the color
- // filter, which could yield incorrect results. (Consider just using
- // saveLayer() w/ this color filter explicitly instead.)
- paint.setColorFilter(paintInfo.context->colorFilter());
- return true;
-}
-
static SkPath::FillType fillRuleFromStyle(const PaintInfo& paintInfo, const SVGComputedStyle& svgStyle)
{
return WebCoreWindRuleToSkFillType(paintInfo.isRenderingClipPathAsMaskImage() ? svgStyle.clipRule() : svgStyle.fillRule());
@@ -102,7 +65,7 @@ void SVGShapePainter::paint(const PaintInfo& paintInfo)
switch (svgStyle.paintOrderType(i)) {
case PT_FILL: {
SkPaint fillPaint;
- if (!paintForLayoutObject(paintContext.paintInfo(), m_renderSVGShape.styleRef(), m_renderSVGShape, ApplyToFillMode, fillPaint))
+ if (!SVGPaintContext::paintForLayoutObject(paintContext.paintInfo(), m_renderSVGShape.styleRef(), m_renderSVGShape, ApplyToFillMode, fillPaint))
break;
fillPaint.setAntiAlias(shouldAntiAlias);
fillShape(paintContext.paintInfo().context, fillPaint, fillRuleFromStyle(paintContext.paintInfo(), svgStyle));
@@ -124,7 +87,7 @@ void SVGShapePainter::paint(const PaintInfo& paintInfo)
}
SkPaint strokePaint;
- if (!paintForLayoutObject(paintContext.paintInfo(), m_renderSVGShape.styleRef(), m_renderSVGShape, ApplyToStrokeMode, strokePaint, additionalPaintServerTransform))
+ if (!SVGPaintContext::paintForLayoutObject(paintContext.paintInfo(), m_renderSVGShape.styleRef(), m_renderSVGShape, ApplyToStrokeMode, strokePaint, additionalPaintServerTransform))
break;
strokePaint.setAntiAlias(shouldAntiAlias);

Powered by Google App Engine
This is Rietveld 408576698