From 938d54ac33044905429ca7f0f55eb7fe2d459321 Mon Sep 17 00:00:00 2001 From: "jhawkins@chromium.org" Date: Wed, 9 Sep 2009 21:17:44 +0000 Subject: Use gfx::Point instead of GET_X/Y_LPARAM to reduce a dependency on ATL. BUG=5027 TEST=none Review URL: http://codereview.chromium.org/195035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25788 0039d316-1c4b-4281-b951-d872f2087c98 --- base/gfx/point.cc | 6 ++++++ base/gfx/point.h | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'base/gfx') diff --git a/base/gfx/point.cc b/base/gfx/point.cc index 4fc031d..05b7596 100644 --- a/base/gfx/point.cc +++ b/base/gfx/point.cc @@ -19,6 +19,12 @@ Point::Point(int x, int y) : x_(x), y_(y) { } #if defined(OS_WIN) +Point::Point(DWORD point) { + POINTS points = MAKEPOINTS(point); + x_ = points.x; + y_ = points.y; +} + Point::Point(const POINT& point) : x_(point.x), y_(point.y) { } diff --git a/base/gfx/point.h b/base/gfx/point.h index 7f95096..513d555 100644 --- a/base/gfx/point.h +++ b/base/gfx/point.h @@ -10,6 +10,7 @@ #include #if defined(OS_WIN) +typedef unsigned long DWORD; typedef struct tagPOINT POINT; #elif defined(OS_MACOSX) #include @@ -25,6 +26,10 @@ class Point { Point(); Point(int x, int y); #if defined(OS_WIN) + // |point| is a DWORD value that contains a coordinate. The x-coordinate is + // the low-order short and the y-coordinate is the high-order short. This + // value is commonly acquired from GetMessagePos/GetCursorPos. + explicit Point(DWORD point); explicit Point(const POINT& point); Point& operator=(const POINT& point); #elif defined(OS_MACOSX) @@ -72,4 +77,4 @@ class Point { std::ostream& operator<<(std::ostream& out, const gfx::Point& p); -#endif // BASE_GFX_POINT_H__ +#endif // BASE_GFX_POINT_H__ -- cgit v1.1