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

Unified Diff: Source/core/svg/SVGPathSeg.h

Issue 1023993002: Rework the SVGPathSource interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Blender fixups. 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.cpp ('k') | Source/core/svg/SVGPathSegListSource.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGPathSeg.h
diff --git a/Source/core/svg/SVGPathSeg.h b/Source/core/svg/SVGPathSeg.h
index 8b1f65601cc306e4cd215b73b5f754988d2b1911..51c5e91b9014422a7e7c7c1cdc421ad96eb6f4b8 100644
--- a/Source/core/svg/SVGPathSeg.h
+++ b/Source/core/svg/SVGPathSeg.h
@@ -22,6 +22,7 @@
#define SVGPathSeg_h
#include "bindings/core/v8/ScriptWrappable.h"
+#include "platform/geometry/FloatPoint.h"
#include "platform/heap/Handle.h"
#include "wtf/RefCounted.h"
#include "wtf/text/WTFString.h"
@@ -59,6 +60,37 @@ enum SVGPathSegType {
PathSegCurveToQuadraticSmoothRel = 19
};
+static inline SVGPathSegType toAbsolutePathSegType(const SVGPathSegType type)
+{
+ // Clear the LSB to get the absolute command.
+ return type >= PathSegMoveToAbs ? static_cast<SVGPathSegType>(type & ~1u) : type;
+}
+
+static inline bool isAbsolutePathSegType(const SVGPathSegType type)
+{
+ // For commands with an ordinal >= PathSegMoveToAbs, and odd number => relative command.
+ return type < PathSegMoveToAbs || type % 2 == 0;
+}
+
+struct PathSegmentData {
+ PathSegmentData()
+ : command(PathSegUnknown)
+ , arcSweep(false)
+ , arcLarge(false)
+ {
+ }
+
+ const FloatPoint& arcRadii() const { return point1; }
+ float arcAngle() const { return point2.x(); }
+
+ SVGPathSegType command;
+ FloatPoint targetPoint;
+ FloatPoint point1;
+ FloatPoint point2;
+ bool arcSweep;
+ bool arcLarge;
+};
+
class SVGPropertyBase;
class SVGPathElement;
class SVGElement;
« no previous file with comments | « Source/core/svg/SVGPathParser.cpp ('k') | Source/core/svg/SVGPathSegListSource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698