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

Unified Diff: Source/core/svg/SVGPathParser.cpp

Issue 1013183002: Stop mutating inputs to decomposeArcToCubic (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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 | « Source/core/svg/SVGPathParser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGPathParser.cpp
diff --git a/Source/core/svg/SVGPathParser.cpp b/Source/core/svg/SVGPathParser.cpp
index 261df8aebede839884bdc4e68040e9d0ffa5ae66..0ba63c116fcc9270a044671cffe91f105aeda85b 100644
--- a/Source/core/svg/SVGPathParser.cpp
+++ b/Source/core/svg/SVGPathParser.cpp
@@ -396,9 +396,9 @@ bool SVGPathParser::parsePathDataFromSource(PathParsingMode pathParsingMode, boo
// This works by converting the SVG arc to "simple" beziers.
// Partly adapted from Niko's code in kdelibs/kdecore/svgicons.
// See also SVG implementation notes: http://www.w3.org/TR/SVG/implnote.html#ArcConversionEndpointToCenter
-bool SVGPathParser::decomposeArcToCubic(float angle, float rx, float ry, FloatPoint& point1, FloatPoint& point2, bool largeArcFlag, bool sweepFlag)
+bool SVGPathParser::decomposeArcToCubic(float angle, float rx, float ry, const FloatPoint& start, const FloatPoint& end, bool largeArcFlag, bool sweepFlag)
{
- FloatSize midPointDistance = point1 - point2;
+ FloatSize midPointDistance = start - end;
midPointDistance.scale(0.5f);
AffineTransform pointTransform;
@@ -422,8 +422,8 @@ bool SVGPathParser::decomposeArcToCubic(float angle, float rx, float ry, FloatPo
pointTransform.scale(1 / rx, 1 / ry);
pointTransform.rotate(-angle);
- point1 = pointTransform.mapPoint(point1);
- point2 = pointTransform.mapPoint(point2);
+ FloatPoint point1 = pointTransform.mapPoint(start);
+ FloatPoint point2 = pointTransform.mapPoint(end);
FloatSize delta = point2 - point1;
float d = delta.width() * delta.width() + delta.height() * delta.height();
« no previous file with comments | « Source/core/svg/SVGPathParser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698