Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Unified Diff: include/core/SkRect.h

Issue 947443003: Move clip off of draw target (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: feedback inc Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/gpu.gypi ('k') | include/gpu/GrClip.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkRect.h
diff --git a/include/core/SkRect.h b/include/core/SkRect.h
index 06f8abe0e444c2e496c05f9e9cdf36e601124d19..69c2dc9cefbed347f006ab69d2f425b4b5e9d630 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -11,6 +11,8 @@
#include "SkPoint.h"
#include "SkSize.h"
+struct SkRect;
+
/** \struct SkIRect
SkIRect holds four 32 bit integer coordinates for a rectangle
@@ -244,6 +246,10 @@ struct SK_API SkIRect {
fRight >= r.fRight && fBottom >= r.fBottom;
}
+ /** Returns true if the specified rectangle r is inside or equal to this rectangle.
+ */
+ bool contains(const SkRect& r) const;
+
/** Return true if this rectangle contains the specified rectangle.
For speed, this method does not check if either this or the specified
rectangles are empty, and if either is, its return value is undefined.
@@ -880,4 +886,10 @@ public:
void dumpHex() const { this->dump(true); }
};
+inline bool SkIRect::contains(const SkRect& r) const {
+ return !r.isEmpty() && !this->isEmpty() && // check for empties
+ (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop &&
+ (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom;
+}
+
#endif
« no previous file with comments | « gyp/gpu.gypi ('k') | include/gpu/GrClip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698