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

Unified Diff: Source/core/svg/SVGPathBuilder.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/SVGPathBuilder.h ('k') | Source/core/svg/SVGPathByteStreamBuilder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGPathBuilder.cpp
diff --git a/Source/core/svg/SVGPathBuilder.cpp b/Source/core/svg/SVGPathBuilder.cpp
index deef74a20b78575ac20adefb8f4365c793404e58..5a587a8bfdd61e09522675f48d8cc6c4df3b671e 100644
--- a/Source/core/svg/SVGPathBuilder.cpp
+++ b/Source/core/svg/SVGPathBuilder.cpp
@@ -24,35 +24,33 @@
#include "config.h"
#include "core/svg/SVGPathBuilder.h"
+#include "core/svg/SVGPathSeg.h"
#include "platform/graphics/Path.h"
namespace blink {
-void SVGPathBuilder::moveTo(const FloatPoint& targetPoint, PathCoordinateMode mode)
+void SVGPathBuilder::emitSegment(const PathSegmentData& segment)
{
- ASSERT(mode == AbsoluteCoordinates);
- if (m_closed && !m_path.isEmpty())
- closePath();
- m_path.moveTo(targetPoint);
- m_closed = false;
-}
-
-void SVGPathBuilder::lineTo(const FloatPoint& targetPoint, PathCoordinateMode mode)
-{
- ASSERT(mode == AbsoluteCoordinates);
- m_path.addLineTo(targetPoint);
-}
-
-void SVGPathBuilder::curveToCubic(const FloatPoint& point1, const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode mode)
-{
- ASSERT(mode == AbsoluteCoordinates);
- m_path.addBezierCurveTo(point1, point2, targetPoint);
-}
-
-void SVGPathBuilder::closePath()
-{
- m_path.closeSubpath();
- m_closed = true;
+ switch (segment.command) {
+ case PathSegMoveToAbs:
+ if (m_closed && !m_path.isEmpty())
+ m_path.closeSubpath();
+ m_path.moveTo(segment.targetPoint);
+ m_closed = false;
+ break;
+ case PathSegLineToAbs:
+ m_path.addLineTo(segment.targetPoint);
+ break;
+ case PathSegClosePath:
+ m_path.closeSubpath();
+ m_closed = true;
+ break;
+ case PathSegCurveToCubicAbs:
+ m_path.addBezierCurveTo(segment.point1, segment.point2, segment.targetPoint);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
}
}
« no previous file with comments | « Source/core/svg/SVGPathBuilder.h ('k') | Source/core/svg/SVGPathByteStreamBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698