OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkRect_DEFINED | 8 #ifndef SkRect_DEFINED |
9 #define SkRect_DEFINED | 9 #define SkRect_DEFINED |
10 | 10 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 274 |
275 bool containsNoEmptyCheck(const SkIRect& r) const { | 275 bool containsNoEmptyCheck(const SkIRect& r) const { |
276 return containsNoEmptyCheck(r.fLeft, r.fTop, r.fRight, r.fBottom); | 276 return containsNoEmptyCheck(r.fLeft, r.fTop, r.fRight, r.fBottom); |
277 } | 277 } |
278 | 278 |
279 /** If r intersects this rectangle, return true and set this rectangle to th
at | 279 /** If r intersects this rectangle, return true and set this rectangle to th
at |
280 intersection, otherwise return false and do not change this rectangle. | 280 intersection, otherwise return false and do not change this rectangle. |
281 If either rectangle is empty, do nothing and return false. | 281 If either rectangle is empty, do nothing and return false. |
282 */ | 282 */ |
283 bool SK_WARN_UNUSED_RESULT intersect(const SkIRect& r) { | 283 bool SK_WARN_UNUSED_RESULT intersect(const SkIRect& r) { |
284 SkASSERT(&r); | |
285 return this->intersect(r.fLeft, r.fTop, r.fRight, r.fBottom); | 284 return this->intersect(r.fLeft, r.fTop, r.fRight, r.fBottom); |
286 } | 285 } |
287 | 286 |
288 /** If rectangles a and b intersect, return true and set this rectangle to | 287 /** If rectangles a and b intersect, return true and set this rectangle to |
289 that intersection, otherwise return false and do not change this | 288 that intersection, otherwise return false and do not change this |
290 rectangle. If either rectangle is empty, do nothing and return false. | 289 rectangle. If either rectangle is empty, do nothing and return false. |
291 */ | 290 */ |
292 bool SK_WARN_UNUSED_RESULT intersect(const SkIRect& a, const SkIRect& b) { | 291 bool SK_WARN_UNUSED_RESULT intersect(const SkIRect& a, const SkIRect& b) { |
293 | 292 |
294 if (!a.isEmpty() && !b.isEmpty() && | 293 if (!a.isEmpty() && !b.isEmpty() && |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 void dumpHex() const { this->dump(true); } | 909 void dumpHex() const { this->dump(true); } |
911 }; | 910 }; |
912 | 911 |
913 inline bool SkIRect::contains(const SkRect& r) const { | 912 inline bool SkIRect::contains(const SkRect& r) const { |
914 return !r.isEmpty() && !this->isEmpty() && // check for empties | 913 return !r.isEmpty() && !this->isEmpty() && // check for empties |
915 (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop && | 914 (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop && |
916 (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom; | 915 (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom; |
917 } | 916 } |
918 | 917 |
919 #endif | 918 #endif |
OLD | NEW |