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 #ifndef UI_GFX_RECT_F_H_ | 5 #ifndef UI_GFX_RECT_F_H_ |
6 #define UI_GFX_RECT_F_H_ | 6 #define UI_GFX_RECT_F_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ui/gfx/point_f.h" | 10 #include "ui/gfx/point_f.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 }; | 48 }; |
49 | 49 |
50 inline bool operator==(const RectF& lhs, const RectF& rhs) { | 50 inline bool operator==(const RectF& lhs, const RectF& rhs) { |
51 return lhs.origin() == rhs.origin() && lhs.size() == rhs.size(); | 51 return lhs.origin() == rhs.origin() && lhs.size() == rhs.size(); |
52 } | 52 } |
53 | 53 |
54 inline bool operator!=(const RectF& lhs, const RectF& rhs) { | 54 inline bool operator!=(const RectF& lhs, const RectF& rhs) { |
55 return !(lhs == rhs); | 55 return !(lhs == rhs); |
56 } | 56 } |
57 | 57 |
58 UI_EXPORT RectF operator+(const RectF& lhs, const Vector2dF& rhs); | |
59 UI_EXPORT RectF operator-(const RectF& lhs, const Vector2dF& rhs); | |
Peter Kasting
2012/11/09 22:02:36
Same comment
| |
60 | |
58 UI_EXPORT RectF IntersectRects(const RectF& a, const RectF& b); | 61 UI_EXPORT RectF IntersectRects(const RectF& a, const RectF& b); |
59 UI_EXPORT RectF UnionRects(const RectF& a, const RectF& b); | 62 UI_EXPORT RectF UnionRects(const RectF& a, const RectF& b); |
60 UI_EXPORT RectF SubtractRects(const RectF& a, const RectF& b); | 63 UI_EXPORT RectF SubtractRects(const RectF& a, const RectF& b); |
61 UI_EXPORT RectF ScaleRect(const RectF& r, float x_scale, float y_scale); | 64 UI_EXPORT RectF ScaleRect(const RectF& r, float x_scale, float y_scale); |
62 | 65 |
63 inline RectF ScaleRect(const RectF& r, float scale) { | 66 inline RectF ScaleRect(const RectF& r, float scale) { |
64 return ScaleRect(r, scale, scale); | 67 return ScaleRect(r, scale, scale); |
65 } | 68 } |
66 | 69 |
67 // Constructs a rectangle with |p1| and |p2| as opposite corners. | 70 // Constructs a rectangle with |p1| and |p2| as opposite corners. |
68 // | 71 // |
69 // This could also be thought of as "the smallest rect that contains both | 72 // This could also be thought of as "the smallest rect that contains both |
70 // points", except that we consider points on the right/bottom edges of the | 73 // points", except that we consider points on the right/bottom edges of the |
71 // rect to be outside the rect. So technically one or both points will not be | 74 // rect to be outside the rect. So technically one or both points will not be |
72 // contained within the rect, because they will appear on one of these edges. | 75 // contained within the rect, because they will appear on one of these edges. |
73 UI_EXPORT RectF BoundingRect(const PointF& p1, const PointF& p2); | 76 UI_EXPORT RectF BoundingRect(const PointF& p1, const PointF& p2); |
74 | 77 |
75 #if !defined(COMPILER_MSVC) | 78 #if !defined(COMPILER_MSVC) |
76 extern template class RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>; | 79 extern template class RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>; |
77 #endif | 80 #endif |
78 | 81 |
79 } // namespace gfx | 82 } // namespace gfx |
80 | 83 |
81 #endif // UI_GFX_RECT_F_H_ | 84 #endif // UI_GFX_RECT_F_H_ |
OLD | NEW |