diff options
author | Mike Reed <reed@google.com> | 2016-12-08 16:06:37 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-12-08 21:45:27 +0000 |
commit | 8e7432b7f98dd592e529a0c8bb038d73ebfb0478 (patch) | |
tree | d3eb65dacc074a58eedfb0d430f969e2e3336774 /include | |
parent | 6a4cdb6ba9ff5aa03186b7fa287f8e4d08be4578 (diff) |
remove SK_SUPPORT_LEGACY_CLIP_REGIONOPS
switch over to SkClipOps now that SK_SUPPORT_LEGACY_CLIP_REGIONOPS is gone
BUG=skia:
Change-Id: Ifdc8b3746d508348a40cc009a4e529a1cb3c405d
Reviewed-on: https://skia-review.googlesource.com/5714
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkCanvas.h | 55 | ||||
-rw-r--r-- | include/core/SkClipStack.h | 42 | ||||
-rw-r--r-- | include/core/SkPictureAnalyzer.h | 2 | ||||
-rw-r--r-- | include/private/SkRecords.h | 6 | ||||
-rw-r--r-- | include/utils/SkDumpCanvas.h | 8 | ||||
-rw-r--r-- | include/utils/SkLuaCanvas.h | 8 | ||||
-rw-r--r-- | include/utils/SkNWayCanvas.h | 8 |
7 files changed, 54 insertions, 75 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 9ba441a23a..3507786ab9 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -42,8 +42,6 @@ class SkSurface; class SkSurface_Base; class SkTextBlob; -//#define SK_SUPPORT_LEGACY_CLIP_REGIONOPS - /** \class SkCanvas A Canvas encapsulates all of the state about drawing into a device (bitmap). @@ -65,25 +63,6 @@ class SK_API SkCanvas : SkNoncopyable { }; public: -#ifdef SK_SUPPORT_LEGACY_CLIP_REGIONOPS - typedef SkRegion::Op ClipOp; - - static const ClipOp kDifference_Op = SkRegion::kDifference_Op; - static const ClipOp kIntersect_Op = SkRegion::kIntersect_Op; - static const ClipOp kUnion_Op = SkRegion::kUnion_Op; - static const ClipOp kXOR_Op = SkRegion::kXOR_Op; - static const ClipOp kReverseDifference_Op = SkRegion::kReverseDifference_Op; - static const ClipOp kReplace_Op = SkRegion::kReplace_Op; -#else - typedef SkClipOp ClipOp; - - static const ClipOp kDifference_Op = kDifference_SkClipOp; - static const ClipOp kIntersect_Op = kIntersect_SkClipOp; - static const ClipOp kUnion_Op = kUnion_SkClipOp; - static const ClipOp kXOR_Op = kXOR_SkClipOp; - static const ClipOp kReverseDifference_Op = kReverseDifference_SkClipOp; - static const ClipOp kReplace_Op = kReplace_SkClipOp; -#endif /** * Attempt to allocate raster canvas, matching the ImageInfo, that will draw directly into the * specified pixels. To access the pixels after drawing to them, the caller should call @@ -493,12 +472,12 @@ public: * @param op The region op to apply to the current clip * @param doAntiAlias true if the clip should be antialiased */ - void clipRect(const SkRect& rect, ClipOp, bool doAntiAlias); - void clipRect(const SkRect& rect, ClipOp op) { + void clipRect(const SkRect& rect, SkClipOp, bool doAntiAlias); + void clipRect(const SkRect& rect, SkClipOp op) { this->clipRect(rect, op, false); } void clipRect(const SkRect& rect, bool doAntiAlias = false) { - this->clipRect(rect, kIntersect_Op, doAntiAlias); + this->clipRect(rect, kIntersect_SkClipOp, doAntiAlias); } /** @@ -507,12 +486,12 @@ public: * @param op The region op to apply to the current clip * @param doAntiAlias true if the clip should be antialiased */ - void clipRRect(const SkRRect& rrect, ClipOp op, bool doAntiAlias); - void clipRRect(const SkRRect& rrect, ClipOp op) { + void clipRRect(const SkRRect& rrect, SkClipOp op, bool doAntiAlias); + void clipRRect(const SkRRect& rrect, SkClipOp op) { this->clipRRect(rrect, op, false); } void clipRRect(const SkRRect& rrect, bool doAntiAlias = false) { - this->clipRRect(rrect, kIntersect_Op, doAntiAlias); + this->clipRRect(rrect, kIntersect_SkClipOp, doAntiAlias); } /** @@ -521,12 +500,12 @@ public: * @param op The region op to apply to the current clip * @param doAntiAlias true if the clip should be antialiased */ - void clipPath(const SkPath& path, ClipOp op, bool doAntiAlias); - void clipPath(const SkPath& path, ClipOp op) { + void clipPath(const SkPath& path, SkClipOp op, bool doAntiAlias); + void clipPath(const SkPath& path, SkClipOp op) { this->clipPath(path, op, false); } void clipPath(const SkPath& path, bool doAntiAlias = false) { - this->clipPath(path, kIntersect_Op, doAntiAlias); + this->clipPath(path, kIntersect_SkClipOp, doAntiAlias); } /** EXPERIMENTAL -- only used for testing @@ -543,7 +522,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, ClipOp op = kIntersect_Op); + void clipRegion(const SkRegion& deviceRgn, SkClipOp op = kIntersect_SkClipOp); /** Return true if the specified rectangle, after being transformed by the current matrix, would lie completely outside of the current clip. Call @@ -1479,10 +1458,10 @@ protected: kSoft_ClipEdgeStyle }; - virtual void onClipRect(const SkRect& rect, ClipOp, ClipEdgeStyle); - virtual void onClipRRect(const SkRRect& rrect, ClipOp, ClipEdgeStyle); - virtual void onClipPath(const SkPath& path, ClipOp, ClipEdgeStyle); - virtual void onClipRegion(const SkRegion& deviceRgn, ClipOp); + virtual void onClipRect(const SkRect& rect, SkClipOp, ClipEdgeStyle); + virtual void onClipRRect(const SkRRect& rrect, SkClipOp, ClipEdgeStyle); + virtual void onClipPath(const SkPath& path, SkClipOp, ClipEdgeStyle); + virtual void onClipRegion(const SkRegion& deviceRgn, SkClipOp); virtual void onDiscard(); @@ -1741,9 +1720,9 @@ private: class SkCanvasClipVisitor { public: virtual ~SkCanvasClipVisitor(); - virtual void clipRect(const SkRect&, SkCanvas::ClipOp, bool antialias) = 0; - virtual void clipRRect(const SkRRect&, SkCanvas::ClipOp, bool antialias) = 0; - virtual void clipPath(const SkPath&, SkCanvas::ClipOp, bool antialias) = 0; + virtual void clipRect(const SkRect&, SkClipOp, bool antialias) = 0; + virtual void clipRRect(const SkRRect&, SkClipOp, bool antialias) = 0; + virtual void clipPath(const SkPath&, SkClipOp, bool antialias) = 0; }; #endif diff --git a/include/core/SkClipStack.h b/include/core/SkClipStack.h index 7a8eb5ca84..98a3f7698b 100644 --- a/include/core/SkClipStack.h +++ b/include/core/SkClipStack.h @@ -54,21 +54,21 @@ public: static const int kTypeCnt = kLastType + 1; Element() { - this->initCommon(0, SkCanvas::kReplace_Op, false); + this->initCommon(0, kReplace_SkClipOp, false); this->setEmpty(); } Element(const Element&); - Element(const SkRect& rect, SkCanvas::ClipOp op, bool doAA) { + Element(const SkRect& rect, SkClipOp op, bool doAA) { this->initRect(0, rect, op, doAA); } - Element(const SkRRect& rrect, SkCanvas::ClipOp op, bool doAA) { + Element(const SkRRect& rrect, SkClipOp op, bool doAA) { this->initRRect(0, rrect, op, doAA); } - Element(const SkPath& path, SkCanvas::ClipOp op, bool doAA) { + Element(const SkPath& path, SkClipOp op, bool doAA) { this->initPath(0, path, op, doAA); } @@ -94,7 +94,7 @@ public: } //!< Call if getType() is not kEmpty to get the set operation used to combine this element. - SkCanvas::ClipOp getOp() const { return fOp; } + SkClipOp getOp() const { return fOp; } //!< Call to get the element as a path, regardless of its type. void asPath(SkPath* path) const; @@ -110,7 +110,7 @@ public: void invertShapeFillType(); //!< Sets the set operation represented by the element. - void setOp(SkCanvas::ClipOp op) { fOp = op; } + void setOp(SkClipOp op) { fOp = op; } /** The GenID can be used by clip stack clients to cache representations of the clip. The ID corresponds to the set of clip elements up to and including this element within the @@ -202,7 +202,7 @@ public: SkTLazy<SkPath> fPath; SkRRect fRRect; int fSaveCount; // save count of stack when this element was added. - SkCanvas::ClipOp fOp; + SkClipOp fOp; Type fType; bool fDoAA; @@ -226,23 +226,23 @@ public: int fGenID; Element(int saveCount) { - this->initCommon(saveCount, SkCanvas::kReplace_Op, false); + this->initCommon(saveCount, kReplace_SkClipOp, false); this->setEmpty(); } - Element(int saveCount, const SkRRect& rrect, SkCanvas::ClipOp op, bool doAA) { + Element(int saveCount, const SkRRect& rrect, SkClipOp op, bool doAA) { this->initRRect(saveCount, rrect, op, doAA); } - Element(int saveCount, const SkRect& rect, SkCanvas::ClipOp op, bool doAA) { + Element(int saveCount, const SkRect& rect, SkClipOp op, bool doAA) { this->initRect(saveCount, rect, op, doAA); } - Element(int saveCount, const SkPath& path, SkCanvas::ClipOp op, bool doAA) { + Element(int saveCount, const SkPath& path, SkClipOp op, bool doAA) { this->initPath(saveCount, path, op, doAA); } - void initCommon(int saveCount, SkCanvas::ClipOp op, bool doAA) { + void initCommon(int saveCount, SkClipOp op, bool doAA) { fSaveCount = saveCount; fOp = op; fDoAA = doAA; @@ -254,13 +254,13 @@ public: fGenID = kInvalidGenID; } - void initRect(int saveCount, const SkRect& rect, SkCanvas::ClipOp op, bool doAA) { + void initRect(int saveCount, const SkRect& rect, SkClipOp op, bool doAA) { fRRect.setRect(rect); fType = kRect_Type; this->initCommon(saveCount, op, doAA); } - void initRRect(int saveCount, const SkRRect& rrect, SkCanvas::ClipOp op, bool doAA) { + void initRRect(int saveCount, const SkRRect& rrect, SkClipOp op, bool doAA) { SkRRect::Type type = rrect.getType(); fRRect = rrect; if (SkRRect::kRect_Type == type || SkRRect::kEmpty_Type == type) { @@ -271,13 +271,13 @@ public: this->initCommon(saveCount, op, doAA); } - void initPath(int saveCount, const SkPath& path, SkCanvas::ClipOp op, bool doAA); + void initPath(int saveCount, const SkPath& path, SkClipOp op, bool doAA); void setEmpty(); // All Element methods below are only used within SkClipStack.cpp inline void checkEmpty() const; - inline bool canBeIntersectedInPlace(int saveCount, SkCanvas::ClipOp op) const; + inline bool canBeIntersectedInPlace(int saveCount, SkClipOp op) const; /* This method checks to see if two rect clips can be safely merged into one. The issue here is that to be strictly correct all the edges of the resulting rect must have the same anti-aliasing. */ @@ -346,14 +346,14 @@ public: */ bool asPath(SkPath* path) const; - void clipDevRect(const SkIRect& ir, SkCanvas::ClipOp op) { + void clipDevRect(const SkIRect& ir, SkClipOp op) { SkRect r; r.set(ir); this->clipRect(r, SkMatrix::I(), op, false); } - void clipRect(const SkRect&, const SkMatrix& matrix, SkCanvas::ClipOp, bool doAA); - void clipRRect(const SkRRect&, const SkMatrix& matrix, SkCanvas::ClipOp, bool doAA); - void clipPath(const SkPath&, const SkMatrix& matrix, SkCanvas::ClipOp, bool doAA); + void clipRect(const SkRect&, const SkMatrix& matrix, SkClipOp, bool doAA); + void clipRRect(const SkRRect&, const SkMatrix& matrix, SkClipOp, bool doAA); + void clipPath(const SkPath&, const SkMatrix& matrix, SkClipOp, bool doAA); // An optimized version of clipDevRect(emptyRect, kIntersect, ...) void clipEmpty(); @@ -424,7 +424,7 @@ public: * Moves the iterator to the topmost element with the specified RegionOp and returns that * element. If no clip element with that op is found, the first element is returned. */ - const Element* skipToTopmost(SkCanvas::ClipOp op); + const Element* skipToTopmost(SkClipOp op); /** * Restarts the iterator on a clip stack. diff --git a/include/core/SkPictureAnalyzer.h b/include/core/SkPictureAnalyzer.h index 62dac30f01..52db8334d4 100644 --- a/include/core/SkPictureAnalyzer.h +++ b/include/core/SkPictureAnalyzer.h @@ -37,7 +37,7 @@ public: /** * Process an explicit clipPath op. */ - void analyzeClipPath(const SkPath&, SkCanvas::ClipOp, bool doAntiAlias); + void analyzeClipPath(const SkPath&, SkClipOp, bool doAntiAlias); /** * Reset all accumulated stats. diff --git a/include/private/SkRecords.h b/include/private/SkRecords.h index 447764fced..54efab1891 100644 --- a/include/private/SkRecords.h +++ b/include/private/SkRecords.h @@ -192,8 +192,8 @@ RECORD(TranslateZ, 0, SkScalar z); struct ClipOpAndAA { ClipOpAndAA() {} - ClipOpAndAA(SkCanvas::ClipOp op, bool aa) : op(op), aa(aa) {} - SkCanvas::ClipOp op : 31; // This really only needs to be 3, but there's no win today to do so. + ClipOpAndAA(SkClipOp op, bool aa) : op(op), aa(aa) {} + SkClipOp op : 31; // This really only needs to be 3, but there's no win today to do so. unsigned aa : 1; // MSVC won't pack an enum with an bool, so we call this an unsigned. }; static_assert(sizeof(ClipOpAndAA) == 4, "ClipOpAndAASize"); @@ -213,7 +213,7 @@ RECORD(ClipRect, 0, RECORD(ClipRegion, 0, SkIRect devBounds; SkRegion region; - SkCanvas::ClipOp op); + SkClipOp op); // While not strictly required, if you have an SkPaint, it's fastest to put it first. RECORD(DrawArc, kDraw_Tag|kHasPaint_Tag, diff --git a/include/utils/SkDumpCanvas.h b/include/utils/SkDumpCanvas.h index c2152f23d8..c8f977ec10 100644 --- a/include/utils/SkDumpCanvas.h +++ b/include/utils/SkDumpCanvas.h @@ -117,10 +117,10 @@ protected: const uint16_t indices[], int indexCount, const SkPaint&) override; - void onClipRect(const SkRect&, ClipOp, ClipEdgeStyle) override; - void onClipRRect(const SkRRect&, ClipOp, ClipEdgeStyle) override; - void onClipPath(const SkPath&, ClipOp, ClipEdgeStyle) override; - void onClipRegion(const SkRegion&, ClipOp) override; + void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; + void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; + void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; + void onClipRegion(const SkRegion&, SkClipOp) override; void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; void onDrawAnnotation(const SkRect&, const char key[], SkData* value) override; diff --git a/include/utils/SkLuaCanvas.h b/include/utils/SkLuaCanvas.h index c03a1f0afc..357ddc81da 100644 --- a/include/utils/SkLuaCanvas.h +++ b/include/utils/SkLuaCanvas.h @@ -63,10 +63,10 @@ protected: const uint16_t indices[], int indexCount, const SkPaint&) override; - void onClipRect(const SkRect&, ClipOp, ClipEdgeStyle) override; - void onClipRRect(const SkRRect&, ClipOp, ClipEdgeStyle) override; - void onClipPath(const SkPath&, ClipOp, ClipEdgeStyle) override; - void onClipRegion(const SkRegion&, ClipOp) override; + void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; + void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; + void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; + void onClipRegion(const SkRegion&, SkClipOp) override; void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; diff --git a/include/utils/SkNWayCanvas.h b/include/utils/SkNWayCanvas.h index d8856dad0b..3ed7d4c41a 100644 --- a/include/utils/SkNWayCanvas.h +++ b/include/utils/SkNWayCanvas.h @@ -76,10 +76,10 @@ protected: const uint16_t indices[], int indexCount, const SkPaint&) override; - void onClipRect(const SkRect&, ClipOp, ClipEdgeStyle) override; - void onClipRRect(const SkRRect&, ClipOp, ClipEdgeStyle) override; - void onClipPath(const SkPath&, ClipOp, ClipEdgeStyle) override; - void onClipRegion(const SkRegion&, ClipOp) override; + void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; + void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; + void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; + void onClipRegion(const SkRegion&, SkClipOp) override; void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; void onDrawAnnotation(const SkRect&, const char[], SkData*) override; |