Chromium Code Reviews| Index: ui/gfx/point.h |
| diff --git a/ui/gfx/point.h b/ui/gfx/point.h |
| index 5984d74655d9ab14ddda6074f703e72e7ad88da0..ae8247675d538532ca03d1a217c45fe33b252d66 100644 |
| --- a/ui/gfx/point.h |
| +++ b/ui/gfx/point.h |
| @@ -8,6 +8,7 @@ |
| #include "ui/base/ui_export.h" |
| #include "ui/gfx/point_base.h" |
| #include "ui/gfx/point_f.h" |
| +#include "ui/gfx/vector2d.h" |
| #if defined(OS_WIN) |
| typedef unsigned long DWORD; |
| @@ -21,7 +22,7 @@ typedef struct tagPOINT POINT; |
| namespace gfx { |
| // A point has an x and y coordinate. |
| -class UI_EXPORT Point : public PointBase<Point, int> { |
| + class UI_EXPORT Point : public PointBase<Point, int, Vector2d> { |
|
tfarina
2012/10/25 00:41:53
nit: indent less two spaces back! somehow you mess
danakj
2012/10/25 00:59:09
Done.
|
| public: |
| Point(); |
| Point(int x, int y); |
| @@ -68,16 +69,24 @@ inline bool operator!=(const Point& lhs, const Point& rhs) { |
| return !(lhs == rhs); |
| } |
| -inline Point operator+(Point lhs, Point rhs) { |
| +inline Point operator+(Point lhs, Vector2d rhs) { |
| return lhs.Add(rhs); |
| } |
| -inline Point operator-(Point lhs, Point rhs) { |
| +inline Point operator-(Point lhs, Vector2d rhs) { |
| return lhs.Subtract(rhs); |
| } |
| +inline Vector2d operator-(Point lhs, Point rhs) { |
| + return lhs.DistanceFrom(rhs); |
| +} |
| + |
| +inline Point PointAtDistanceFromOrigin(const Vector2d& distance_from_origin) { |
| + return Point(distance_from_origin.x(), distance_from_origin.y()); |
| +} |
| + |
| #if !defined(COMPILER_MSVC) |
| -extern template class PointBase<Point, int>; |
| +extern template class PointBase<Point, int, Vector2d>; |
| #endif |
| } // namespace gfx |