Pull path nested types out to root level
Change-Id: I66a854fa157c5c22d0caaf8bc6f5989baa876a5c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/241079
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 92f55b4..7729156 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -5,6 +5,7 @@
-----
* Remove isRectContour and ksNestedFillRects from public
+ * Start to move nested SkPath types (e.g. Direction, Verb) up to root level in SkPathTypes.h
Milestone 79
diff --git a/include/core/SkPath.h b/include/core/SkPath.h
index deb7bba..6a87648 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -9,6 +9,7 @@
#define SkPath_DEFINED
#include "include/core/SkMatrix.h"
+#include "include/core/SkPathTypes.h"
#include "include/private/SkPathRef.h"
#include "include/private/SkTo.h"
@@ -54,8 +55,8 @@
travel counterclockwise.
*/
enum Direction : int {
- kCW_Direction, //!< contour travels clockwise
- kCCW_Direction, //!< contour travels counterclockwise
+ kCW_Direction = static_cast<int>(SkPathDirection::kCW),
+ kCCW_Direction = static_cast<int>(SkPathDirection::kCCW)
};
/** Constructs an empty SkPath. By default, SkPath has no verbs, no SkPoint, and no weights.
@@ -160,10 +161,10 @@
kInverseEvenOdd_FillType fills where the number of contour edges is even.
*/
enum FillType {
- kWinding_FillType, //!< is enclosed by a non-zero sum of contour directions
- kEvenOdd_FillType, //!< is enclosed by an odd number of contours
- kInverseWinding_FillType, //!< is enclosed by a zero sum of contour directions
- kInverseEvenOdd_FillType, //!< is enclosed by an even number of contours
+ kWinding_FillType = static_cast<int>(SkPathFillType::kWinding),
+ kEvenOdd_FillType = static_cast<int>(SkPathFillType::kEvenOdd),
+ kInverseWinding_FillType = static_cast<int>(SkPathFillType::kInverseWinding),
+ kInverseEvenOdd_FillType = static_cast<int>(SkPathFillType::kInverseEvenOdd)
};
/** Returns FillType, the rule used to fill SkPath. FillType of a new SkPath is
@@ -211,9 +212,9 @@
if needed by destination SkSurface.
*/
enum Convexity : uint8_t {
- kUnknown_Convexity, //!< indicates Convexity has not been determined
- kConvex_Convexity, //!< one contour made of a simple geometry without indentations
- kConcave_Convexity, //!< more than one contour, or a geometry with indentations
+ kUnknown_Convexity = static_cast<int>(SkPathConvexityType::kUnknown),
+ kConvex_Convexity = static_cast<int>(SkPathConvexityType::kConvex),
+ kConcave_Convexity = static_cast<int>(SkPathConvexityType::kConcave),
};
/** Computes SkPath::Convexity if required, and returns stored value.
@@ -1352,10 +1353,10 @@
instance, if SkPath only contains lines, only the kLine_SegmentMask bit is set.
*/
enum SegmentMask {
- kLine_SegmentMask = 1 << 0, //!< contains one or more lines
- kQuad_SegmentMask = 1 << 1, //!< contains one or more quads
- kConic_SegmentMask = 1 << 2, //!< contains one or more conics
- kCubic_SegmentMask = 1 << 3, //!< contains one or more cubics
+ kLine_SegmentMask = kLine_SkPathSegmentMask,
+ kQuad_SegmentMask = kQuad_SkPathSegmentMask,
+ kConic_SegmentMask = kConic_SkPathSegmentMask,
+ kCubic_SegmentMask = kCubic_SkPathSegmentMask,
};
/** Returns a mask, where each set bit corresponds to a SegmentMask constant
@@ -1373,13 +1374,13 @@
manage contour, and terminate SkPath.
*/
enum Verb {
- kMove_Verb, //!< starts new contour at next SkPoint
- kLine_Verb, //!< adds line from last point to next SkPoint
- kQuad_Verb, //!< adds quad from last point
- kConic_Verb, //!< adds conic from last point
- kCubic_Verb, //!< adds cubic from last point
- kClose_Verb, //!< closes contour
- kDone_Verb, //!< terminates SkPath
+ kMove_Verb = static_cast<int>(SkPathVerb::kMove),
+ kLine_Verb = static_cast<int>(SkPathVerb::kLine),
+ kQuad_Verb = static_cast<int>(SkPathVerb::kQuad),
+ kConic_Verb = static_cast<int>(SkPathVerb::kConic),
+ kCubic_Verb = static_cast<int>(SkPathVerb::kCubic),
+ kClose_Verb = static_cast<int>(SkPathVerb::kClose),
+ kDone_Verb = static_cast<int>(SkPathVerb::kDone),
};
/** \class SkPath::Iter
diff --git a/include/core/SkPathTypes.h b/include/core/SkPathTypes.h
new file mode 100644
index 0000000..4f5adf4
--- /dev/null
+++ b/include/core/SkPathTypes.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2019 Google LLC.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkPathTypes_DEFINED
+#define SkPathTypes_DEFINED
+
+#include "include/core/SkTypes.h"
+
+enum class SkPathFillType {
+ /** Specifies that "inside" is computed by a non-zero sum of signed edge crossings */
+ kWinding,
+ /** Specifies that "inside" is computed by an odd number of edge crossings */
+ kEvenOdd,
+ /** Same as Winding, but draws outside of the path, rather than inside */
+ kInverseWinding,
+ /** Same as EvenOdd, but draws outside of the path, rather than inside */
+ kInverseEvenOdd
+};
+
+enum class SkPathConvexityType {
+ kUnknown,
+ kConvex,
+ kConcave
+};
+
+enum class SkPathDirection {
+ /** clockwise direction for adding closed contours */
+ kCW,
+ /** counter-clockwise direction for adding closed contours */
+ kCCW,
+};
+
+enum SkPathSegmentMask {
+ kLine_SkPathSegmentMask = 1 << 0,
+ kQuad_SkPathSegmentMask = 1 << 1,
+ kConic_SkPathSegmentMask = 1 << 2,
+ kCubic_SkPathSegmentMask = 1 << 3,
+};
+
+enum class SkPathVerb {
+ kMove, //!< iter.next returns 1 point
+ kLine, //!< iter.next returns 2 points
+ kQuad, //!< iter.next returns 3 points
+ kConic, //!< iter.next returns 3 points + iter.conicWeight()
+ kCubic, //!< iter.next returns 4 points
+ kClose, //!< iter.next returns 1 point (contour's moveTo pt)
+ kDone, //!< iter.next returns 0 points
+};
+
+#endif