OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 CC_GEOMETRY_H_ | 5 #ifndef CC_GEOMETRY_H_ |
6 #define CC_GEOMETRY_H_ | 6 #define CC_GEOMETRY_H_ |
7 | 7 |
8 #include "ui/gfx/rect.h" | 8 #include "ui/gfx/rect.h" |
9 #include "ui/gfx/rect_f.h" | 9 #include "ui/gfx/rect_f.h" |
10 #include "ui/gfx/vector2d.h" | 10 #include "ui/gfx/vector2d.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 } | 58 } |
59 | 59 |
60 inline gfx::Point BottomRight(gfx::Rect rect) { | 60 inline gfx::Point BottomRight(gfx::Rect rect) { |
61 return gfx::Point(rect.right(), rect.bottom()); | 61 return gfx::Point(rect.right(), rect.bottom()); |
62 } | 62 } |
63 | 63 |
64 inline gfx::PointF BottomRight(gfx::RectF rect) { | 64 inline gfx::PointF BottomRight(gfx::RectF rect) { |
65 return gfx::PointF(rect.right(), rect.bottom()); | 65 return gfx::PointF(rect.right(), rect.bottom()); |
66 } | 66 } |
67 | 67 |
68 // Return a vector that is |v| scaled by the given scale factors along each | |
69 // axis. | |
70 inline gfx::Vector2dF ScaleVector2d(gfx::Vector2dF v, float x_scale, float y_sca
le) { | |
71 gfx::Vector2dF scaled = v; | |
72 scaled.Scale(x_scale, y_scale); | |
73 return scaled; | |
74 } | |
75 | |
76 // Return a vector that is |v| scaled by the given scale factor. | |
77 inline gfx::Vector2dF ScaleVector2d(gfx::Vector2dF v, float scale) { | |
78 return ScaleVector2d(v, scale, scale); | |
79 } | |
80 | |
81 } // namespace cc | 68 } // namespace cc |
82 | 69 |
83 #endif // CC_GEOMETRY_H_ | 70 #endif // CC_GEOMETRY_H_ |
OLD | NEW |