diff options
author | sugoi@google.com <sugoi@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-12-06 20:13:11 +0000 |
---|---|---|
committer | sugoi@google.com <sugoi@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-12-06 20:13:11 +0000 |
commit | 12b4e27ae1a29460e91a59f38122483e1faec697 (patch) | |
tree | ed783f409c707e748cd0db8c635a6e97d328886d /include/core | |
parent | df6fe603a592be6495a61b4ad2e8b8fad452c2ac (diff) |
As part of preliminary groundwork for a chromium fix, this changelist is deprecating GrPathFill so that SkPath::FillType is used everywhere in order to remove some code duplication between Skia and Ganesh.
BUG=chromium:135111
TEST=Try path rendering tests from the gm
Review URL: https://codereview.appspot.com/6875058
git-svn-id: http://skia.googlecode.com/svn/trunk@6693 2bbb7eff-a529-9590-31e7-b0007b416f81
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 |