aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2016-12-09 13:14:25 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-09 13:14:41 +0000
commita129dfef2aaab0b5995cdf1ab7b2cdd41c29cf72 (patch)
tree9398e074cf0408ba24f739130c062b2bfbe4435e /include/core
parent76073c11040204d51dceb49cbd0b05be8e7fd0a2 (diff)
Revert "remove SK_SUPPORT_LEGACY_CLIP_REGIONOPS"
This reverts commit 8e7432b7f98dd592e529a0c8bb038d73ebfb0478. Reason for revert: <INSERT REASONING HERE> external/skia/bench/../tools/android/SkAndroidSDKCanvas.h:103:36: error: C++ requires a type specifier for all declarations void onClipRect(const SkRect&, ClipOp, ClipEdgeStyle) override; Original change's description: > 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> > TBR=reed@google.com,reviews@skia.org BUG=skia: NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: If26ea91d7464615e43c1d3d2f726e337ff56b55c Reviewed-on: https://skia-review.googlesource.com/5721 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkCanvas.h55
-rw-r--r--include/core/SkClipStack.h42
-rw-r--r--include/core/SkPictureAnalyzer.h2
3 files changed, 60 insertions, 39 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 3507786ab9..9ba441a23a 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -42,6 +42,8 @@ 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).
@@ -63,6 +65,25 @@ 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
@@ -472,12 +493,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, SkClipOp, bool doAntiAlias);
- void clipRect(const SkRect& rect, SkClipOp op) {
+ void clipRect(const SkRect& rect, ClipOp, bool doAntiAlias);
+ void clipRect(const SkRect& rect, ClipOp op) {
this->clipRect(rect, op, false);
}
void clipRect(const SkRect& rect, bool doAntiAlias = false) {
- this->clipRect(rect, kIntersect_SkClipOp, doAntiAlias);
+ this->clipRect(rect, kIntersect_Op, doAntiAlias);
}
/**
@@ -486,12 +507,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, SkClipOp op, bool doAntiAlias);
- void clipRRect(const SkRRect& rrect, SkClipOp op) {
+ void clipRRect(const SkRRect& rrect, ClipOp op, bool doAntiAlias);
+ void clipRRect(const SkRRect& rrect, ClipOp op) {
this->clipRRect(rrect, op, false);
}
void clipRRect(const SkRRect& rrect, bool doAntiAlias = false) {
- this->clipRRect(rrect, kIntersect_SkClipOp, doAntiAlias);
+ this->clipRRect(rrect, kIntersect_Op, doAntiAlias);
}
/**
@@ -500,12 +521,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, SkClipOp op, bool doAntiAlias);
- void clipPath(const SkPath& path, SkClipOp op) {
+ void clipPath(const SkPath& path, ClipOp op, bool doAntiAlias);
+ void clipPath(const SkPath& path, ClipOp op) {
this->clipPath(path, op, false);
}
void clipPath(const SkPath& path, bool doAntiAlias = false) {
- this->clipPath(path, kIntersect_SkClipOp, doAntiAlias);
+ this->clipPath(path, kIntersect_Op, doAntiAlias);
}
/** EXPERIMENTAL -- only used for testing
@@ -522,7 +543,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, ClipOp op = kIntersect_Op);
/** Return true if the specified rectangle, after being transformed by the
current matrix, would lie completely outside of the current clip. Call
@@ -1458,10 +1479,10 @@ protected:
kSoft_ClipEdgeStyle
};
- 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 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 onDiscard();
@@ -1720,9 +1741,9 @@ private:
class SkCanvasClipVisitor {
public:
virtual ~SkCanvasClipVisitor();
- 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;
+ 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;
};
#endif
diff --git a/include/core/SkClipStack.h b/include/core/SkClipStack.h
index 98a3f7698b..7a8eb5ca84 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, kReplace_SkClipOp, false);
+ this->initCommon(0, SkCanvas::kReplace_Op, false);
this->setEmpty();
}
Element(const Element&);
- Element(const SkRect& rect, SkClipOp op, bool doAA) {
+ Element(const SkRect& rect, SkCanvas::ClipOp op, bool doAA) {
this->initRect(0, rect, op, doAA);
}
- Element(const SkRRect& rrect, SkClipOp op, bool doAA) {
+ Element(const SkRRect& rrect, SkCanvas::ClipOp op, bool doAA) {
this->initRRect(0, rrect, op, doAA);
}
- Element(const SkPath& path, SkClipOp op, bool doAA) {
+ Element(const SkPath& path, SkCanvas::ClipOp 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.
- SkClipOp getOp() const { return fOp; }
+ SkCanvas::ClipOp 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(SkClipOp op) { fOp = op; }
+ void setOp(SkCanvas::ClipOp 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.
- SkClipOp fOp;
+ SkCanvas::ClipOp fOp;
Type fType;
bool fDoAA;
@@ -226,23 +226,23 @@ public:
int fGenID;
Element(int saveCount) {
- this->initCommon(saveCount, kReplace_SkClipOp, false);
+ this->initCommon(saveCount, SkCanvas::kReplace_Op, false);
this->setEmpty();
}
- Element(int saveCount, const SkRRect& rrect, SkClipOp op, bool doAA) {
+ Element(int saveCount, const SkRRect& rrect, SkCanvas::ClipOp op, bool doAA) {
this->initRRect(saveCount, rrect, op, doAA);
}
- Element(int saveCount, const SkRect& rect, SkClipOp op, bool doAA) {
+ Element(int saveCount, const SkRect& rect, SkCanvas::ClipOp op, bool doAA) {
this->initRect(saveCount, rect, op, doAA);
}
- Element(int saveCount, const SkPath& path, SkClipOp op, bool doAA) {
+ Element(int saveCount, const SkPath& path, SkCanvas::ClipOp op, bool doAA) {
this->initPath(saveCount, path, op, doAA);
}
- void initCommon(int saveCount, SkClipOp op, bool doAA) {
+ void initCommon(int saveCount, SkCanvas::ClipOp op, bool doAA) {
fSaveCount = saveCount;
fOp = op;
fDoAA = doAA;
@@ -254,13 +254,13 @@ public:
fGenID = kInvalidGenID;
}
- void initRect(int saveCount, const SkRect& rect, SkClipOp op, bool doAA) {
+ void initRect(int saveCount, const SkRect& rect, SkCanvas::ClipOp op, bool doAA) {
fRRect.setRect(rect);
fType = kRect_Type;
this->initCommon(saveCount, op, doAA);
}
- void initRRect(int saveCount, const SkRRect& rrect, SkClipOp op, bool doAA) {
+ void initRRect(int saveCount, const SkRRect& rrect, SkCanvas::ClipOp 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, SkClipOp op, bool doAA);
+ void initPath(int saveCount, const SkPath& path, SkCanvas::ClipOp op, bool doAA);
void setEmpty();
// All Element methods below are only used within SkClipStack.cpp
inline void checkEmpty() const;
- inline bool canBeIntersectedInPlace(int saveCount, SkClipOp op) const;
+ inline bool canBeIntersectedInPlace(int saveCount, SkCanvas::ClipOp 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, SkClipOp op) {
+ void clipDevRect(const SkIRect& ir, SkCanvas::ClipOp op) {
SkRect r;
r.set(ir);
this->clipRect(r, SkMatrix::I(), op, false);
}
- 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);
+ 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);
// 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(SkClipOp op);
+ const Element* skipToTopmost(SkCanvas::ClipOp op);
/**
* Restarts the iterator on a clip stack.
diff --git a/include/core/SkPictureAnalyzer.h b/include/core/SkPictureAnalyzer.h
index 52db8334d4..62dac30f01 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&, SkClipOp, bool doAntiAlias);
+ void analyzeClipPath(const SkPath&, SkCanvas::ClipOp, bool doAntiAlias);
/**
* Reset all accumulated stats.