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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 | 685 |
686 public: | 686 public: |
687 /** | 687 /** |
688 * Return true if this rectangle is not empty, and the specified sides of | 688 * Return true if this rectangle is not empty, and the specified sides of |
689 * a rectangle are not empty, and they intersect. | 689 * a rectangle are not empty, and they intersect. |
690 */ | 690 */ |
691 bool intersects(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom
) const { | 691 bool intersects(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom
) const { |
692 return Intersects(fLeft, fTop, fRight, fBottom, left, top, right, bottom
); | 692 return Intersects(fLeft, fTop, fRight, fBottom, left, top, right, bottom
); |
693 } | 693 } |
694 | 694 |
| 695 bool intersects(const SkRect& r) const { |
| 696 return Intersects(fLeft, fTop, fRight, fBottom, |
| 697 r.fLeft, r.fTop, r.fRight, r.fBottom); |
| 698 } |
| 699 |
695 /** | 700 /** |
696 * Return true if rectangles a and b are not empty and intersect. | 701 * Return true if rectangles a and b are not empty and intersect. |
697 */ | 702 */ |
698 static bool Intersects(const SkRect& a, const SkRect& b) { | 703 static bool Intersects(const SkRect& a, const SkRect& b) { |
699 return Intersects(a.fLeft, a.fTop, a.fRight, a.fBottom, | 704 return Intersects(a.fLeft, a.fTop, a.fRight, a.fBottom, |
700 b.fLeft, b.fTop, b.fRight, b.fBottom); | 705 b.fLeft, b.fTop, b.fRight, b.fBottom); |
701 } | 706 } |
702 | 707 |
703 /** | 708 /** |
704 * Update this rectangle to enclose itself and the specified rectangle. | 709 * Update this rectangle to enclose itself and the specified rectangle. |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 * cast-safe way to treat the rect as an array of (4) SkScalars. | 872 * cast-safe way to treat the rect as an array of (4) SkScalars. |
868 */ | 873 */ |
869 const SkScalar* asScalars() const { return &fLeft; } | 874 const SkScalar* asScalars() const { return &fLeft; } |
870 | 875 |
871 void dump(bool asHex) const; | 876 void dump(bool asHex) const; |
872 void dump() const { this->dump(false); } | 877 void dump() const { this->dump(false); } |
873 void dumpHex() const { this->dump(true); } | 878 void dumpHex() const { this->dump(true); } |
874 }; | 879 }; |
875 | 880 |
876 #endif | 881 #endif |
OLD | NEW |