Index: ui/gfx/point.h |
diff --git a/ui/gfx/point.h b/ui/gfx/point.h |
index 5984d74655d9ab14ddda6074f703e72e7ad88da0..a3081c131744108ad71c5eae062c1e9b4246d0b0 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> { |
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) { |
sky
2012/10/26 20:22:17
const& on both
|
return lhs.Add(rhs); |
} |
-inline Point operator-(Point lhs, Point rhs) { |
+inline Point operator-(Point lhs, Vector2d rhs) { |
sky
2012/10/26 20:22:17
const& on both
|
return lhs.Subtract(rhs); |
} |
+inline Vector2d operator-(Point lhs, Point rhs) { |
sky
2012/10/26 20:22:17
const& on both
|
+ 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 |