Index: Source/core/svg/SVGPathParser.cpp |
diff --git a/Source/core/svg/SVGPathParser.cpp b/Source/core/svg/SVGPathParser.cpp |
index e81624d18fed5b3a9bc16116551063f299b1b18e..60ac27d988b9bc08fc3cdea3e5729e3970a7c042 100644 |
--- a/Source/core/svg/SVGPathParser.cpp |
+++ b/Source/core/svg/SVGPathParser.cpp |
@@ -47,6 +47,24 @@ bool SVGPathParser::initialCommandIsMoveTo() |
return command == PathSegMoveToAbs || command == PathSegMoveToRel; |
} |
+bool SVGPathParser::parsePath() |
+{ |
+ while (m_source->hasMoreData()) { |
+ PathSegmentData segment = m_source->parseSegment(); |
+ if (segment.command == PathSegUnknown) |
+ return false; |
+ |
+ m_consumer->emitSegment(segment); |
+ |
+ if (!m_consumer->continueConsuming()) |
+ return true; |
+ |
+ if (m_source->hasMoreData()) |
+ m_consumer->incrementPathSegmentCount(); |
+ } |
+ return true; |
+} |
+ |
class NormalizingConsumer { |
STACK_ALLOCATED(); |
public: |
@@ -207,36 +225,6 @@ void NormalizingConsumer::emitSegment(PathSegmentData& segment) |
m_lastCommand = originalCommand; |
} |
-bool SVGPathParser::parsePathDataFromSource(PathParsingMode pathParsingMode, bool checkForInitialMoveTo) |
-{ |
- ASSERT(m_source); |
- ASSERT(m_consumer); |
- |
- if (checkForInitialMoveTo && !initialCommandIsMoveTo()) |
- return false; |
- |
- NormalizingConsumer normalizer(m_consumer); |
- |
- while (m_source->hasMoreData()) { |
- PathSegmentData segment = m_source->parseSegment(); |
- if (segment.command == PathSegUnknown) |
- return false; |
- |
- if (pathParsingMode == NormalizedParsing) { |
- normalizer.emitSegment(segment); |
- } else { |
- m_consumer->emitSegment(segment); |
- } |
- |
- if (!m_consumer->continueConsuming()) |
- return true; |
- |
- if (m_source->hasMoreData()) |
- m_consumer->incrementPathSegmentCount(); |
- } |
- return true; |
-} |
- |
// 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 |
@@ -342,4 +330,24 @@ bool NormalizingConsumer::decomposeArcToCubic(const FloatPoint& currentPoint, co |
return true; |
} |
+bool SVGPathParser::parseAndNormalizePath() |
f(malita)
2015/04/01 03:59:21
These two are quite similar - would it be feasible
fs
2015/04/01 08:55:29
Yes, I hope to get to that point eventually. Haven
|
+{ |
+ NormalizingConsumer normalizer(m_consumer); |
+ |
+ while (m_source->hasMoreData()) { |
+ PathSegmentData segment = m_source->parseSegment(); |
+ if (segment.command == PathSegUnknown) |
+ return false; |
+ |
+ normalizer.emitSegment(segment); |
+ |
+ if (!m_consumer->continueConsuming()) |
+ return true; |
+ |
+ if (m_source->hasMoreData()) |
+ m_consumer->incrementPathSegmentCount(); |
+ } |
+ return true; |
+} |
+ |
} |