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_GEOMETRY_POINT_H_ | 5 #ifndef UI_GFX_GEOMETRY_POINT_H_ |
6 #define UI_GFX_GEOMETRY_POINT_H_ | 6 #define UI_GFX_GEOMETRY_POINT_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <string> | 9 #include <string> |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 inline Vector2d operator-(const Point& lhs, const Point& rhs) { | 117 inline Vector2d operator-(const Point& lhs, const Point& rhs) { |
118 return Vector2d(lhs.x() - rhs.x(), lhs.y() - rhs.y()); | 118 return Vector2d(lhs.x() - rhs.x(), lhs.y() - rhs.y()); |
119 } | 119 } |
120 | 120 |
121 inline Point PointAtOffsetFromOrigin(const Vector2d& offset_from_origin) { | 121 inline Point PointAtOffsetFromOrigin(const Vector2d& offset_from_origin) { |
122 return Point(offset_from_origin.x(), offset_from_origin.y()); | 122 return Point(offset_from_origin.x(), offset_from_origin.y()); |
123 } | 123 } |
124 | 124 |
125 // This is declared here for use in gtest-based unit tests but is defined in | 125 // This is declared here for use in gtest-based unit tests but is defined in |
126 // the gfx_test_support target. Depend on that to use this in your unit test. | 126 // the //ui/gfx:test_support target. Depend on that to use this in your unit |
127 // This should not be used in production code - call ToString() instead. | 127 // test. This should not be used in production code - call ToString() instead. |
128 void PrintTo(const Point& point, ::std::ostream* os); | 128 void PrintTo(const Point& point, ::std::ostream* os); |
129 | 129 |
130 // Helper methods to scale a gfx::Point to a new gfx::Point. | 130 // Helper methods to scale a gfx::Point to a new gfx::Point. |
131 GFX_EXPORT Point ScaleToCeiledPoint(const Point& point, | 131 GFX_EXPORT Point ScaleToCeiledPoint(const Point& point, |
132 float x_scale, | 132 float x_scale, |
133 float y_scale); | 133 float y_scale); |
134 GFX_EXPORT Point ScaleToCeiledPoint(const Point& point, float x_scale); | 134 GFX_EXPORT Point ScaleToCeiledPoint(const Point& point, float x_scale); |
135 GFX_EXPORT Point ScaleToFlooredPoint(const Point& point, | 135 GFX_EXPORT Point ScaleToFlooredPoint(const Point& point, |
136 float x_scale, | 136 float x_scale, |
137 float y_scale); | 137 float y_scale); |
138 GFX_EXPORT Point ScaleToFlooredPoint(const Point& point, float x_scale); | 138 GFX_EXPORT Point ScaleToFlooredPoint(const Point& point, float x_scale); |
139 GFX_EXPORT Point ScaleToRoundedPoint(const Point& point, | 139 GFX_EXPORT Point ScaleToRoundedPoint(const Point& point, |
140 float x_scale, | 140 float x_scale, |
141 float y_scale); | 141 float y_scale); |
142 GFX_EXPORT Point ScaleToRoundedPoint(const Point& point, float x_scale); | 142 GFX_EXPORT Point ScaleToRoundedPoint(const Point& point, float x_scale); |
143 | 143 |
144 } // namespace gfx | 144 } // namespace gfx |
145 | 145 |
146 #endif // UI_GFX_GEOMETRY_POINT_H_ | 146 #endif // UI_GFX_GEOMETRY_POINT_H_ |
OLD | NEW |