| 29 | |
| 30 | |
| 31 | class RectI |
| 32 | { |
| 33 | public: |
| 34 | Point2I point; |
| 35 | Point2I extent; |
| 36 | |
| 37 | public: |
| 38 | RectI() { } |
| 39 | RectI(const Point2I& in_rMin, |
| 40 | const Point2I& in_rExtent); |
| 41 | RectI(const S32 in_left, const S32 in_top, |
| 42 | const S32 in_width, const S32 in_height); |
| 43 | |
| 44 | void set(const Point2I& in_rMin, const Point2I& in_rExtent); |
| 45 | void set(const S32 in_left, const S32 in_top, |
| 46 | const S32 in_width, const S32 in_height); |
| 47 | |
| 48 | bool intersect(const RectI& clipRect); |
| 49 | bool pointInRect(const Point2I& pt) const; |
| 50 | bool overlaps(RectI R) const; |
| 51 | bool contains(const RectI& R) const; |
| 52 | void inset(S32 x, S32 y); |
| 53 | |
| 54 | void unionRects(const RectI&); |
| 55 | |
| 56 | S32 len_x() const; |
| 57 | S32 len_y() const; |
| 58 | |
| 59 | /// Returns the area of the rectangle. |
| 60 | S32 area() const { return extent.x * extent.y; } |
| 61 | |
| 62 | bool operator==(const RectI&) const; |
| 63 | bool operator!=(const RectI&) const; |
| 64 | |
| 65 | bool isValidRect() const { return (extent.x > 0 && extent.y > 0); } |
| 66 | |
| 67 | public: |
| 68 | |
| 69 | /// A rect of zero extent. |
| 70 | static const RectI Zero; |
| 71 | |
| 72 | /// A rect of 1,1 extent. |
| 73 | static const RectI One; |
| 74 | |
| 75 | }; |
| 76 | |
| 77 | class RectF |
| 78 | { |
no outgoing calls
no test coverage detected