diff options
author | girard@chromium.org <girard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-15 17:24:22 +0000 |
---|---|---|
committer | girard@chromium.org <girard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-15 17:24:22 +0000 |
commit | 3b5540c8fa4eb9c5df915343445615ee55f4dca1 (patch) | |
tree | 629ae261960cfb4bd2bef0c8015504e7c0cbab7e /ui/base | |
parent | 739c3b8f7e245597db337947dde33f2ac84513b1 (diff) | |
download | chromium_src-3b5540c8fa4eb9c5df915343445615ee55f4dca1.zip chromium_src-3b5540c8fa4eb9c5df915343445615ee55f4dca1.tar.gz chromium_src-3b5540c8fa4eb9c5df915343445615ee55f4dca1.tar.bz2 |
Correct title bar size for HiDPI Windows
GetSystemMetrics was reporting title bar height in pixels, but we were interpreting them as DIP. This resulted in a double-scaled title bar.
BUG=149881
Review URL: https://chromiumcodereview.appspot.com/12684006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188432 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base')
-rw-r--r-- | ui/base/win/dpi.cc | 5 | ||||
-rw-r--r-- | ui/base/win/dpi.h | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/ui/base/win/dpi.cc b/ui/base/win/dpi.cc index 6c22885..75d63bb 100644 --- a/ui/base/win/dpi.cc +++ b/ui/base/win/dpi.cc @@ -114,6 +114,11 @@ gfx::Size DIPToScreenSize(const gfx::Size& dip_size) { return gfx::ToFlooredSize(gfx::ScaleSize(dip_size, GetDeviceScaleFactor())); } +int GetSystemMetricsInDIP(int metric) { + return static_cast<int>(GetSystemMetrics(metric) / + GetDeviceScaleFactor() + 0.5); +} + double GetUndocumentedDPIScale() { // TODO(girard): Remove this code when chrome is DPIAware. static double scale = -1.0; diff --git a/ui/base/win/dpi.h b/ui/base/win/dpi.h index bfc0417..e37392b 100644 --- a/ui/base/win/dpi.h +++ b/ui/base/win/dpi.h @@ -38,6 +38,10 @@ UI_EXPORT gfx::Size ScreenToDIPSize(const gfx::Size& size_in_pixels); UI_EXPORT gfx::Size DIPToScreenSize(const gfx::Size& dip_size); +// Win32's GetSystemMetrics uses pixel measures. This function calls +// GetSystemMetrics for the given |metric|, then converts the result to DIP. +UI_EXPORT int GetSystemMetricsInDIP(int metric); + // The OS secretly scales apps that are not DPIAware. This is not visible // through standard OS calls like GetWindowPos(), or through GetDPIScale(). // Returns the scale factor of the display, where 96 DPI is 1.0. |