aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
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, 39 insertions, 60 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.