| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 GdkRectangle ToGdkRectangle() const; | 65 GdkRectangle ToGdkRectangle() const; |
| 66 #elif defined(OS_MACOSX) | 66 #elif defined(OS_MACOSX) |
| 67 // Construct an equivalent CoreGraphics object. | 67 // Construct an equivalent CoreGraphics object. |
| 68 CGRect ToCGRect() const; | 68 CGRect ToCGRect() const; |
| 69 #endif | 69 #endif |
| 70 | 70 |
| 71 operator RectF() const { | 71 operator RectF() const { |
| 72 return RectF(origin().x(), origin().y(), size().width(), size().height()); | 72 return RectF(origin().x(), origin().y(), size().width(), size().height()); |
| 73 } | 73 } |
| 74 | 74 |
| 75 RectF Scale(float scale) const WARN_UNUSED_RESULT { | |
| 76 return Scale(scale, scale); | |
| 77 } | |
| 78 | |
| 79 RectF Scale(float x_scale, float y_scale) const WARN_UNUSED_RESULT { | |
| 80 RectF original = *this; | |
| 81 return original.Scale(x_scale, y_scale); | |
| 82 } | |
| 83 | |
| 84 std::string ToString() const; | 75 std::string ToString() const; |
| 85 }; | 76 }; |
| 86 | 77 |
| 87 inline bool operator==(const Rect& lhs, const Rect& rhs) { | 78 inline bool operator==(const Rect& lhs, const Rect& rhs) { |
| 88 return lhs.origin() == rhs.origin() && lhs.size() == rhs.size(); | 79 return lhs.origin() == rhs.origin() && lhs.size() == rhs.size(); |
| 89 } | 80 } |
| 90 | 81 |
| 91 inline bool operator!=(const Rect& lhs, const Rect& rhs) { | 82 inline bool operator!=(const Rect& lhs, const Rect& rhs) { |
| 92 return !(lhs == rhs); | 83 return !(lhs == rhs); |
| 93 } | 84 } |
| 94 | 85 |
| 95 #if !defined(COMPILER_MSVC) | 86 #if !defined(COMPILER_MSVC) |
| 96 extern template class RectBase<Rect, Point, Size, Insets, int>; | 87 extern template class RectBase<Rect, Point, Size, Insets, int>; |
| 97 #endif | 88 #endif |
| 98 | 89 |
| 99 } // namespace gfx | 90 } // namespace gfx |
| 100 | 91 |
| 101 #endif // UI_GFX_RECT_H_ | 92 #endif // UI_GFX_RECT_H_ |
| OLD | NEW |