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

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

Issue 1143313007: Apply vector-effect transform to path geometry - not stroke geometry (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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
« no previous file with comments | « LayoutTests/svg/stroke/non-scaling-stroke-zero-length-subpath-linecaps-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/SVGShapePainter.cpp
diff --git a/Source/core/paint/SVGShapePainter.cpp b/Source/core/paint/SVGShapePainter.cpp
index 1b240fa4a7e3dbeb4683035aa35a6f7460946e97..24c484159044a0e073dde8449aef26a58ae2b8f5 100644
--- a/Source/core/paint/SVGShapePainter.cpp
+++ b/Source/core/paint/SVGShapePainter.cpp
@@ -240,23 +240,23 @@ void SVGShapePainter::strokeZeroLengthLineCaps(GraphicsContext* context, const S
fillPaint.setStyle(SkPaint::kFill_Style);
AffineTransform nonScalingTransform;
- if (m_layoutSVGShape.hasNonScalingStroke())
+ bool hasNonScalingStroke = m_layoutSVGShape.hasNonScalingStroke();
+ if (hasNonScalingStroke)
nonScalingTransform = m_layoutSVGShape.nonScalingStrokeTransform();
- Path tempPath;
- for (size_t i = 0; i < zeroLengthLineCaps->size(); ++i) {
- FloatRect subpathRect = LayoutSVGPath::zeroLengthSubpathRect((*zeroLengthLineCaps)[i], m_layoutSVGShape.strokeWidth());
- tempPath.clear();
+ for (const FloatPoint& capPosition : *zeroLengthLineCaps) {
+ FloatPoint position = capPosition;
+ // If non-scaling-stroke is in effect, apply the transform to the
+ // position (being the non-stroke geometry), and then paint the
+ // requested shape. The CTM should've been adjusted in
+ // SVGShapePainter::paint.
+ if (hasNonScalingStroke)
+ position = nonScalingTransform.mapPoint(position);
+ FloatRect subpathRect = LayoutSVGPath::zeroLengthSubpathRect(position, m_layoutSVGShape.strokeWidth());
if (m_layoutSVGShape.style()->svgStyle().capStyle() == SquareCap)
- tempPath.addRect(subpathRect);
+ context->drawRect(subpathRect, fillPaint);
else
- tempPath.addEllipse(subpathRect);
- // This open-codes LayoutSVGShape::nonScalingStrokePath, because the
- // requirements here differ (we have a temporary path that we can
- // mutate.)
- if (m_layoutSVGShape.hasNonScalingStroke())
- tempPath.transform(nonScalingTransform);
- context->drawPath(tempPath.skPath(), fillPaint);
+ context->drawOval(subpathRect, fillPaint);
}
}
« no previous file with comments | « LayoutTests/svg/stroke/non-scaling-stroke-zero-length-subpath-linecaps-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698