| 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 ~RectF() {} | 43 ~RectF() {} |
| 44 | 44 |
| 45 // Scales the rectangle by |scale|. | 45 // Scales the rectangle by |scale|. |
| 46 void Scale(float scale) { | 46 void Scale(float scale) { |
| 47 Scale(scale, scale); | 47 Scale(scale, scale); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void Scale(float x_scale, float y_scale) { | 50 void Scale(float x_scale, float y_scale) { |
| 51 set_origin(ScalePoint(origin(), x_scale, y_scale)); | 51 set_origin(ScalePoint(origin(), x_scale, y_scale)); |
| 52 | 52 set_size(ScaleSize(size(), x_scale, y_scale)); |
| 53 SizeF new_size = gfx::ScaleSize(size(), x_scale, y_scale); | |
| 54 new_size.ClampToNonNegative(); | |
| 55 set_size(new_size); | |
| 56 } | 53 } |
| 57 | 54 |
| 58 // This method reports if the RectF can be safely converted to an integer | 55 // This method reports if the RectF can be safely converted to an integer |
| 59 // Rect. When it is false, some dimension of the RectF is outside the bounds | 56 // Rect. When it is false, some dimension of the RectF is outside the bounds |
| 60 // of what an integer can represent, and converting it to a Rect will require | 57 // of what an integer can represent, and converting it to a Rect will require |
| 61 // clamping. | 58 // clamping. |
| 62 bool IsExpressibleAsRect() const; | 59 bool IsExpressibleAsRect() const; |
| 63 | 60 |
| 64 std::string ToString() const; | 61 std::string ToString() const; |
| 65 }; | 62 }; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 96 // contained within the rect, because they will appear on one of these edges. | 93 // contained within the rect, because they will appear on one of these edges. |
| 97 UI_EXPORT RectF BoundingRect(const PointF& p1, const PointF& p2); | 94 UI_EXPORT RectF BoundingRect(const PointF& p1, const PointF& p2); |
| 98 | 95 |
| 99 #if !defined(COMPILER_MSVC) | 96 #if !defined(COMPILER_MSVC) |
| 100 extern template class RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>; | 97 extern template class RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>; |
| 101 #endif | 98 #endif |
| 102 | 99 |
| 103 } // namespace gfx | 100 } // namespace gfx |
| 104 | 101 |
| 105 #endif // UI_GFX_RECT_F_H_ | 102 #endif // UI_GFX_RECT_F_H_ |
| OLD | NEW |