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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 }; | 42 }; |
43 | 43 |
44 inline bool operator==(const RectF& lhs, const RectF& rhs) { | 44 inline bool operator==(const RectF& lhs, const RectF& rhs) { |
45 return lhs.origin() == rhs.origin() && lhs.size() == rhs.size(); | 45 return lhs.origin() == rhs.origin() && lhs.size() == rhs.size(); |
46 } | 46 } |
47 | 47 |
48 inline bool operator!=(const RectF& lhs, const RectF& rhs) { | 48 inline bool operator!=(const RectF& lhs, const RectF& rhs) { |
49 return !(lhs == rhs); | 49 return !(lhs == rhs); |
50 } | 50 } |
51 | 51 |
| 52 inline RectF Intersection(const RectF& a, const RectF& b) { |
| 53 RectF result = a; |
| 54 result.Intersect(b); |
| 55 return result; |
| 56 } |
| 57 |
| 58 inline RectF Union(const RectF& a, const RectF& b) { |
| 59 RectF result = a; |
| 60 result.Union(b); |
| 61 return result; |
| 62 } |
| 63 |
| 64 inline RectF Subtraction(const RectF& a, const RectF& b) { |
| 65 RectF result = a; |
| 66 result.Subtract(b); |
| 67 return result; |
| 68 } |
| 69 |
| 70 inline RectF Scale(const RectF& r, float x_scale, float y_scale) { |
| 71 RectF result = r; |
| 72 result.Scale(x_scale, y_scale); |
| 73 return result; |
| 74 } |
| 75 |
| 76 inline RectF Scale(const RectF& r, float scale) { |
| 77 return Scale(r, scale, scale); |
| 78 } |
| 79 |
52 #if !defined(COMPILER_MSVC) | 80 #if !defined(COMPILER_MSVC) |
53 extern template class RectBase<RectF, PointF, SizeF, InsetsF, float>; | 81 extern template class RectBase<RectF, PointF, SizeF, InsetsF, float>; |
54 #endif | 82 #endif |
55 | 83 |
56 } // namespace gfx | 84 } // namespace gfx |
57 | 85 |
58 #endif // UI_GFX_RECT_F_H_ | 86 #endif // UI_GFX_RECT_F_H_ |
OLD | NEW |