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

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

Issue 751323002: Simplify SVGPathByteStream-based path-query functions (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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/SVGPathUtilities.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/SVGPathUtilities.cpp
diff --git a/Source/core/svg/SVGPathUtilities.cpp b/Source/core/svg/SVGPathUtilities.cpp
index 0842fe8efc625314d576a7f170503d4b3dd6c4bb..0da2181f6f899ee9163470a7b5b05144d7c4fc5f 100644
--- a/Source/core/svg/SVGPathUtilities.cpp
+++ b/Source/core/svg/SVGPathUtilities.cpp
@@ -103,46 +103,43 @@ bool addToSVGPathByteStream(SVGPathByteStream& fromStream, const SVGPathByteStre
return blender.addAnimatedPath(repeatCount);
}
-bool getSVGPathSegAtLengthFromSVGPathByteStream(const SVGPathByteStream& stream, float length, unsigned& pathSeg)
+unsigned getSVGPathSegAtLengthFromSVGPathByteStream(const SVGPathByteStream& stream, float length)
{
if (stream.isEmpty())
- return false;
+ return 0;
PathTraversalState traversalState(PathTraversalState::TraversalSegmentAtLength);
SVGPathTraversalStateBuilder builder(traversalState, length);
SVGPathByteStreamSource source(stream);
SVGPathParser parser(&source, &builder);
- bool ok = parser.parsePathDataFromSource(NormalizedParsing);
- pathSeg = builder.pathSegmentIndex();
- return ok;
+ parser.parsePathDataFromSource(NormalizedParsing);
+ return builder.pathSegmentIndex();
}
-bool getTotalLengthOfSVGPathByteStream(const SVGPathByteStream& stream, float& totalLength)
+float getTotalLengthOfSVGPathByteStream(const SVGPathByteStream& stream)
{
if (stream.isEmpty())
- return false;
+ return 0;
PathTraversalState traversalState(PathTraversalState::TraversalTotalLength);
SVGPathTraversalStateBuilder builder(traversalState);
SVGPathByteStreamSource source(stream);
SVGPathParser parser(&source, &builder);
- bool ok = parser.parsePathDataFromSource(NormalizedParsing);
- totalLength = builder.totalLength();
- return ok;
+ parser.parsePathDataFromSource(NormalizedParsing);
+ return builder.totalLength();
}
-bool getPointAtLengthOfSVGPathByteStream(const SVGPathByteStream& stream, float length, FloatPoint& point)
+FloatPoint getPointAtLengthOfSVGPathByteStream(const SVGPathByteStream& stream, float length)
{
if (stream.isEmpty())
- return false;
+ return FloatPoint();
PathTraversalState traversalState(PathTraversalState::TraversalPointAtLength);
SVGPathTraversalStateBuilder builder(traversalState, length);
SVGPathByteStreamSource source(stream);
SVGPathParser parser(&source, &builder);
- bool ok = parser.parsePathDataFromSource(NormalizedParsing);
- point = builder.currentPoint();
- return ok;
+ parser.parsePathDataFromSource(NormalizedParsing);
+ return builder.currentPoint();
}
}
« no previous file with comments | « Source/core/svg/SVGPathUtilities.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698