Index: include/core/SkRect.h |
diff --git a/include/core/SkRect.h b/include/core/SkRect.h |
index 69c2dc9cefbed347f006ab69d2f425b4b5e9d630..8d68c97febb730ec29bf694964bc4254a4b565c4 100644 |
--- a/include/core/SkRect.h |
+++ b/include/core/SkRect.h |
@@ -784,6 +784,16 @@ public: |
} |
/** |
+ * Returns true if the specified rectangle r is inside or equal to this rectangle. |
+ */ |
+ bool contains(const SkIRect& r) const { |
+ // todo: can we eliminate the this->isEmpty check? |
+ return !r.isEmpty() && !this->isEmpty() && |
+ fLeft <= SkIntToScalar(r.fLeft) && fTop <= SkIntToScalar(r.fTop) && |
+ fRight >= SkIntToScalar(r.fRight) && fBottom >= SkIntToScalar(r.fBottom); |
+ } |
+ |
+ /** |
* Set the dst rectangle by rounding this rectangle's coordinates to their |
* nearest integer values using SkScalarRoundToInt. |
*/ |