diff options
author | girard@chromium.org <girard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-12 17:00:14 +0000 |
---|---|---|
committer | girard@chromium.org <girard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-12 17:00:14 +0000 |
commit | f33ad01a701cd61dac938d2069b9f32b3fbe9dac (patch) | |
tree | 86742cdee21540a296b7d9422c9b4d7b424f5ce1 /ui/base/win | |
parent | 216a3dc542084fc301465624c14920266d44ac63 (diff) | |
download | chromium_src-f33ad01a701cd61dac938d2069b9f32b3fbe9dac.zip chromium_src-f33ad01a701cd61dac938d2069b9f32b3fbe9dac.tar.gz chromium_src-f33ad01a701cd61dac938d2069b9f32b3fbe9dac.tar.bz2 |
Enable high dpi in win/views.
BUG=149881
Review URL: https://chromiumcodereview.appspot.com/16336027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205831 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/win')
-rw-r--r-- | ui/base/win/dpi.cc | 5 | ||||
-rw-r--r-- | ui/base/win/dpi.h | 2 | ||||
-rw-r--r-- | ui/base/win/events_win.cc | 5 |
3 files changed, 11 insertions, 1 deletions
diff --git a/ui/base/win/dpi.cc b/ui/base/win/dpi.cc index 9b2db5b..e4bc457 100644 --- a/ui/base/win/dpi.cc +++ b/ui/base/win/dpi.cc @@ -104,6 +104,11 @@ gfx::Point ScreenToDIPPoint(const gfx::Point& pixel_point) { gfx::ScalePoint(pixel_point, 1.0f / GetDeviceScaleFactor())); } +gfx::Point DIPToScreenPoint(const gfx::Point& dip_point) { + return gfx::ToFlooredPoint( + gfx::ScalePoint(dip_point, GetDeviceScaleFactor())); +} + gfx::Rect ScreenToDIPRect(const gfx::Rect& pixel_bounds) { // TODO(kevers): Switch to non-deprecated method for float to int conversions. return gfx::ToFlooredRectDeprecated( diff --git a/ui/base/win/dpi.h b/ui/base/win/dpi.h index e37392b..90edc7c 100644 --- a/ui/base/win/dpi.h +++ b/ui/base/win/dpi.h @@ -30,6 +30,8 @@ UI_EXPORT float GetDeviceScaleFactor(); UI_EXPORT gfx::Point ScreenToDIPPoint(const gfx::Point& pixel_point); +UI_EXPORT gfx::Point DIPToScreenPoint(const gfx::Point& dip_point); + UI_EXPORT gfx::Rect ScreenToDIPRect(const gfx::Rect& pixel_bounds); UI_EXPORT gfx::Rect DIPToScreenRect(const gfx::Rect& dip_bounds); diff --git a/ui/base/win/events_win.cc b/ui/base/win/events_win.cc index 596d8c5..458c8e6 100644 --- a/ui/base/win/events_win.cc +++ b/ui/base/win/events_win.cc @@ -11,6 +11,7 @@ #include "base/win/win_util.h" #include "ui/base/events/event_utils.h" #include "ui/base/keycodes/keyboard_code_conversion_win.h" +#include "ui/base/win/dpi.h" #include "ui/gfx/point.h" namespace ui { @@ -211,7 +212,9 @@ gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) { POINT native_point = { GET_X_LPARAM(native_event.lParam), GET_Y_LPARAM(native_event.lParam) }; ScreenToClient(native_event.hwnd, &native_point); - return gfx::Point(native_point); + gfx::Point location(native_point); + location = ui::win::ScreenToDIPPoint(location); + return location; } gfx::Point EventSystemLocationFromNative( |