aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkRasterClip.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-04-27 07:49:17 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-27 07:49:17 -0700
commit1e7f5e708e5daeb0c18ae49001c9e3cd5e3b13cb (patch)
treec012c4ab0679914ca494e3ccceac6ce2242faed2 /src/core/SkRasterClip.cpp
parent4b6566644f704cf9e30c71fa547c9b5915752792 (diff)
remove 'deprecated' region from SkDraw
Most call-sites that used it just took its bounds, so it was trivial to convert them to get the bounds of the RasterClip. Two clients wanted the actual region: 1. layeriter for android 2. pdf Android already only has BW clips, so should be safe. PDF now overrides its clip methods to ensure that all clips are BW. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1925693002 Review URL: https://codereview.chromium.org/1925693002
Diffstat (limited to 'src/core/SkRasterClip.cpp')
-rw-r--r--src/core/SkRasterClip.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/core/SkRasterClip.cpp b/src/core/SkRasterClip.cpp
index 89467677f3..88bfbafc36 100644
--- a/src/core/SkRasterClip.cpp
+++ b/src/core/SkRasterClip.cpp
@@ -24,6 +24,14 @@ SkRasterClip::SkRasterClip(const SkRasterClip& src) {
SkDEBUGCODE(this->validate();)
}
+SkRasterClip::SkRasterClip(const SkRegion& rgn) : fBW(rgn) {
+ fForceConservativeRects = false;
+ fIsBW = true;
+ fIsEmpty = this->computeIsEmpty(); // bounds might be empty, so compute
+ fIsRect = !fIsEmpty;
+ SkDEBUGCODE(this->validate();)
+}
+
SkRasterClip::SkRasterClip(const SkIRect& bounds, bool forceConservativeRects) : fBW(bounds) {
fForceConservativeRects = forceConservativeRects;
fIsBW = true;
@@ -44,6 +52,22 @@ SkRasterClip::~SkRasterClip() {
SkDEBUGCODE(this->validate();)
}
+bool SkRasterClip::operator==(const SkRasterClip& other) const {
+ // This impl doesn't care if fForceConservativeRects is the same in both, only the current state
+
+ if (fIsBW != other.fIsBW) {
+ return false;
+ }
+ bool isEqual = fIsBW ? fBW == other.fBW : fAA == other.fAA;
+#ifdef SK_DEBUG
+ if (isEqual) {
+ SkASSERT(fIsEmpty == other.fIsEmpty);
+ SkASSERT(fIsRect == other.fIsRect);
+ }
+#endif
+ return isEqual;
+}
+
bool SkRasterClip::isComplex() const {
return fIsBW ? fBW.isComplex() : !fAA.isEmpty();
}