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

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

Issue 1037463002: Rework the SVGPathConsumer interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase; FIXME -> TODO. 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/SVGPathTraversalStateBuilder.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/SVGPathTraversalStateBuilder.cpp
diff --git a/Source/core/svg/SVGPathTraversalStateBuilder.cpp b/Source/core/svg/SVGPathTraversalStateBuilder.cpp
index b1bb11ac3062de2796631f3065e84013aadda6b0..492a9a894a71092aacb8588ea2121f359e1f8511 100644
--- a/Source/core/svg/SVGPathTraversalStateBuilder.cpp
+++ b/Source/core/svg/SVGPathTraversalStateBuilder.cpp
@@ -23,6 +23,9 @@
#include "config.h"
#include "core/svg/SVGPathTraversalStateBuilder.h"
+#include "core/svg/SVGPathSeg.h"
+#include "platform/graphics/PathTraversalState.h"
+
namespace blink {
SVGPathTraversalStateBuilder::SVGPathTraversalStateBuilder(PathTraversalState::PathTraversalAction traversalAction, float desiredLength)
@@ -32,24 +35,24 @@ SVGPathTraversalStateBuilder::SVGPathTraversalStateBuilder(PathTraversalState::P
m_traversalState.m_desiredLength = desiredLength;
}
-void SVGPathTraversalStateBuilder::moveTo(const FloatPoint& targetPoint, PathCoordinateMode)
-{
- m_traversalState.m_totalLength += m_traversalState.moveTo(targetPoint);
-}
-
-void SVGPathTraversalStateBuilder::lineTo(const FloatPoint& targetPoint, PathCoordinateMode)
-{
- m_traversalState.m_totalLength += m_traversalState.lineTo(targetPoint);
-}
-
-void SVGPathTraversalStateBuilder::curveToCubic(const FloatPoint& point1, const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode)
-{
- m_traversalState.m_totalLength += m_traversalState.cubicBezierTo(point1, point2, targetPoint);
-}
-
-void SVGPathTraversalStateBuilder::closePath()
+void SVGPathTraversalStateBuilder::emitSegment(const PathSegmentData& segment)
{
- m_traversalState.m_totalLength += m_traversalState.closeSubpath();
+ switch (segment.command) {
+ case PathSegMoveToAbs:
+ m_traversalState.m_totalLength += m_traversalState.moveTo(segment.targetPoint);
+ break;
+ case PathSegLineToAbs:
+ m_traversalState.m_totalLength += m_traversalState.lineTo(segment.targetPoint);
+ break;
+ case PathSegClosePath:
+ m_traversalState.m_totalLength += m_traversalState.closeSubpath();
+ break;
+ case PathSegCurveToCubicAbs:
+ m_traversalState.m_totalLength += m_traversalState.cubicBezierTo(segment.point1, segment.point2, segment.targetPoint);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
}
bool SVGPathTraversalStateBuilder::continueConsuming()
« no previous file with comments | « Source/core/svg/SVGPathTraversalStateBuilder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698