diff options
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkCanvas.h | 14 | ||||
-rw-r--r-- | include/core/SkClipOp.h | 21 | ||||
-rw-r--r-- | include/core/SkClipStack.h | 11 |
3 files changed, 39 insertions, 7 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 3507786ab9..620c5820b9 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -42,6 +42,12 @@ class SkSurface; class SkSurface_Base; class SkTextBlob; +#ifdef SK_SUPPORT_LEGACY_CLIPOPS_PLAIN_ENUM + #define SkCanvasImpl_DefaultClipOp kIntersect_SkClipOp +#else + #define SkCanvasImpl_DefaultClipOp SkClipOp::kIntersect +#endif + /** \class SkCanvas A Canvas encapsulates all of the state about drawing into a device (bitmap). @@ -477,7 +483,7 @@ public: this->clipRect(rect, op, false); } void clipRect(const SkRect& rect, bool doAntiAlias = false) { - this->clipRect(rect, kIntersect_SkClipOp, doAntiAlias); + this->clipRect(rect, SkCanvasImpl_DefaultClipOp, doAntiAlias); } /** @@ -491,7 +497,7 @@ public: this->clipRRect(rrect, op, false); } void clipRRect(const SkRRect& rrect, bool doAntiAlias = false) { - this->clipRRect(rrect, kIntersect_SkClipOp, doAntiAlias); + this->clipRRect(rrect, SkCanvasImpl_DefaultClipOp, doAntiAlias); } /** @@ -505,7 +511,7 @@ public: this->clipPath(path, op, false); } void clipPath(const SkPath& path, bool doAntiAlias = false) { - this->clipPath(path, kIntersect_SkClipOp, doAntiAlias); + this->clipPath(path, SkCanvasImpl_DefaultClipOp, doAntiAlias); } /** EXPERIMENTAL -- only used for testing @@ -522,7 +528,7 @@ public: @param deviceRgn The region to apply to the current clip @param op The region op to apply to the current clip */ - void clipRegion(const SkRegion& deviceRgn, SkClipOp op = kIntersect_SkClipOp); + void clipRegion(const SkRegion& deviceRgn, SkClipOp op = SkCanvasImpl_DefaultClipOp); /** Return true if the specified rectangle, after being transformed by the current matrix, would lie completely outside of the current clip. Call diff --git a/include/core/SkClipOp.h b/include/core/SkClipOp.h index 2e4fbbf868..4a69ef29d5 100644 --- a/include/core/SkClipOp.h +++ b/include/core/SkClipOp.h @@ -10,7 +10,10 @@ #include "SkTypes.h" -// these kept in SkRegion::Op order for now ... +// SkClipOp enum values always match the corresponding values in SkRegion::Op + +#ifdef SK_SUPPORT_LEGACY_CLIPOPS_PLAIN_ENUM + enum SkClipOp { kDifference_SkClipOp = 0, kIntersect_SkClipOp = 1, @@ -23,4 +26,20 @@ enum SkClipOp { kReplace_SkClipOp = 5, }; +#else + +enum class SkClipOp { + kDifference = 0, + kIntersect = 1, + + // Goal: remove these, since they can grow the current clip + + kUnion = 2, + kXOR = 3, + kReverseDifference = 4, + kReplace = 5, +}; + +#endif + #endif diff --git a/include/core/SkClipStack.h b/include/core/SkClipStack.h index 98a3f7698b..64f462601f 100644 --- a/include/core/SkClipStack.h +++ b/include/core/SkClipStack.h @@ -18,6 +18,13 @@ class SkCanvasClipVisitor; + +#ifdef SK_SUPPORT_LEGACY_CLIPOPS_PLAIN_ENUM + #define SkClipStackImpl_ReplaceOp kReplace_SkClipOp +#else + #define SkClipStackImpl_ReplaceOp SkClipOp::kReplace +#endif + // Because a single save/restore state can have multiple clips, this class // stores the stack depth (fSaveCount) and clips (fDeque) separately. // Each clip in fDeque stores the stack state to which it belongs @@ -54,7 +61,7 @@ public: static const int kTypeCnt = kLastType + 1; Element() { - this->initCommon(0, kReplace_SkClipOp, false); + this->initCommon(0, SkClipStackImpl_ReplaceOp, false); this->setEmpty(); } @@ -226,7 +233,7 @@ public: int fGenID; Element(int saveCount) { - this->initCommon(saveCount, kReplace_SkClipOp, false); + this->initCommon(saveCount, SkClipStackImpl_ReplaceOp, false); this->setEmpty(); } |