OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Defines a simple integer rectangle class. The containment semantics | 5 // Defines a simple integer rectangle class. The containment semantics |
6 // are array-like; that is, the coordinate (x, y) is considered to be | 6 // are array-like; that is, the coordinate (x, y) is considered to be |
7 // contained by the rectangle, but the coordinate (x + width, y) is not. | 7 // contained by the rectangle, but the coordinate (x + width, y) is not. |
8 // The class will happily let you create malformed rectangles (that is, | 8 // The class will happily let you create malformed rectangles (that is, |
9 // rectangles with negative width and/or height), but there will be assertions | 9 // rectangles with negative width and/or height), but there will be assertions |
10 // in the operations (such as Contains()) to complain in this case. | 10 // in the operations (such as Contains()) to complain in this case. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 }; | 68 }; |
69 | 69 |
70 inline bool operator==(const Rect& lhs, const Rect& rhs) { | 70 inline bool operator==(const Rect& lhs, const Rect& rhs) { |
71 return lhs.origin() == rhs.origin() && lhs.size() == rhs.size(); | 71 return lhs.origin() == rhs.origin() && lhs.size() == rhs.size(); |
72 } | 72 } |
73 | 73 |
74 inline bool operator!=(const Rect& lhs, const Rect& rhs) { | 74 inline bool operator!=(const Rect& lhs, const Rect& rhs) { |
75 return !(lhs == rhs); | 75 return !(lhs == rhs); |
76 } | 76 } |
77 | 77 |
| 78 UI_EXPORT Rect IntersectRects(const Rect& a, const Rect& b); |
| 79 UI_EXPORT Rect UnionRects(const Rect& a, const Rect& b); |
| 80 UI_EXPORT Rect SubtractRects(const Rect& a, const Rect& b); |
| 81 |
78 #if !defined(COMPILER_MSVC) | 82 #if !defined(COMPILER_MSVC) |
79 extern template class RectBase<Rect, Point, Size, Insets, int>; | 83 extern template class RectBase<Rect, Point, Size, Insets, int>; |
80 #endif | 84 #endif |
81 | 85 |
82 } // namespace gfx | 86 } // namespace gfx |
83 | 87 |
84 #endif // UI_GFX_RECT_H_ | 88 #endif // UI_GFX_RECT_H_ |
OLD | NEW |