Chromium Code Reviews| Index: ui/gfx/point_f.h |
| diff --git a/ui/gfx/point_f.h b/ui/gfx/point_f.h |
| index d6cded9c6fe11a7380518e6d35426862d19a6043..93ee67fb611011e268b16d1665eaf0da7f278972 100644 |
| --- a/ui/gfx/point_f.h |
| +++ b/ui/gfx/point_f.h |
| @@ -9,11 +9,12 @@ |
| #include "ui/base/ui_export.h" |
| #include "ui/gfx/point_base.h" |
| +#include "ui/gfx/vector2d_f.h" |
| namespace gfx { |
| // A floating version of gfx::Point. |
| -class UI_EXPORT PointF : public PointBase<PointF, float> { |
| +class UI_EXPORT PointF : public PointBase<PointF, float, Vector2dF> { |
| public: |
| PointF(); |
| PointF(float x, float y); |
| @@ -39,16 +40,24 @@ inline bool operator!=(const PointF& lhs, const PointF& rhs) { |
| return !(lhs == rhs); |
| } |
| -inline PointF operator+(PointF lhs, PointF rhs) { |
| +inline PointF operator+(PointF lhs, Vector2dF rhs) { |
|
sky
2012/10/26 20:22:17
const& on both
|
| return lhs.Add(rhs); |
| } |
| -inline PointF operator-(PointF lhs, PointF rhs) { |
| +inline PointF operator-(PointF lhs, Vector2dF rhs) { |
|
sky
2012/10/26 20:22:17
const& on both
|
| return lhs.Subtract(rhs); |
| } |
| +inline Vector2dF operator-(PointF lhs, PointF rhs) { |
|
sky
2012/10/26 20:22:17
const& on both
|
| + return lhs.DistanceFrom(rhs); |
| +} |
| + |
| +inline PointF PointAtDistanceFromOrigin(const Vector2dF& distance_from_origin) { |
| + return PointF(distance_from_origin.x(), distance_from_origin.y()); |
| +} |
| + |
| #if !defined(COMPILER_MSVC) |
| -extern template class PointBase<PointF, float>; |
| +extern template class PointBase<PointF, float, Vector2dF>; |
| #endif |
| } // namespace gfx |