diff options
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkPath.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/include/core/SkPath.h b/include/core/SkPath.h index 942342dd56..b85e827331 100644 --- a/include/core/SkPath.h +++ b/include/core/SkPath.h @@ -88,7 +88,7 @@ public: } /** Returns true if the filltype is one of the Inverse variants */ - bool isInverseFillType() const { return (fFillType & 2) != 0; } + bool isInverseFillType() const { return IsInverseFill((FillType)fFillType); } /** * Toggle between inverse and normal filltypes. This reverse the return @@ -522,6 +522,28 @@ public: } /** + * Returns whether or not a fill type is inverted + */ + static bool IsInverseFill(FillType fill) { + SK_COMPILE_ASSERT(0 == kWinding_FillType, fill_type_mismatch); + SK_COMPILE_ASSERT(1 == kEvenOdd_FillType, fill_type_mismatch); + SK_COMPILE_ASSERT(2 == kInverseWinding_FillType, fill_type_mismatch); + SK_COMPILE_ASSERT(3 == kInverseEvenOdd_FillType, fill_type_mismatch); + return (fill & 2) != 0; + } + + /** + * Returns the equivalent non-inverted fill type to the given fill type + */ + static FillType NonInverseFill(FillType fill) { + SK_COMPILE_ASSERT(0 == kWinding_FillType, fill_type_mismatch); + SK_COMPILE_ASSERT(1 == kEvenOdd_FillType, fill_type_mismatch); + SK_COMPILE_ASSERT(2 == kInverseWinding_FillType, fill_type_mismatch); + SK_COMPILE_ASSERT(3 == kInverseEvenOdd_FillType, fill_type_mismatch); + return (FillType)(fill & 1); + } + + /** * Tries to quickly compute the direction of the first non-degenerate * contour. If it can be computed, return true and set dir to that * direction. If it cannot be (quickly) determined, return false and ignore |