diff options
author | girard@chromium.org <girard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-22 13:22:59 +0000 |
---|---|---|
committer | girard@chromium.org <girard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-22 13:22:59 +0000 |
commit | 40bd0e2dbb489669dedd5eaab25f1dee629e9b09 (patch) | |
tree | 54345cd9f0f2a56abcd72137e1cef2be7a051e66 /ui | |
parent | 8d33ef915d77c93f9a5a726a6861719ed8fd0732 (diff) | |
download | chromium_src-40bd0e2dbb489669dedd5eaab25f1dee629e9b09.zip chromium_src-40bd0e2dbb489669dedd5eaab25f1dee629e9b09.tar.gz chromium_src-40bd0e2dbb489669dedd5eaab25f1dee629e9b09.tar.bz2 |
Disable win/ash on high dpi screens
BUG=321694
Review URL: https://codereview.chromium.org/79033002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236762 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/gfx/win/dpi.cc | 22 | ||||
-rw-r--r-- | ui/gfx/win/dpi.h | 7 |
2 files changed, 26 insertions, 3 deletions
diff --git a/ui/gfx/win/dpi.cc b/ui/gfx/win/dpi.cc index acd7ee3..33abdf6 100644 --- a/ui/gfx/win/dpi.cc +++ b/ui/gfx/win/dpi.cc @@ -36,10 +36,30 @@ float GetUnforcedDeviceScaleFactor() { return static_cast<float>(gfx::GetDPI().width()) / static_cast<float>(kDefaultDPIX); } + +float GetModernUIScaleWrapper() { + float result = 1.0f; + typedef float(WINAPI *GetModernUIScalePtr)(VOID); + HMODULE lib = LoadLibraryA("metro_driver.dll"); + if (lib) { + GetModernUIScalePtr func = + reinterpret_cast<GetModernUIScalePtr>( + GetProcAddress(lib, "GetModernUIScale")); + if (func) + result = func(); + FreeLibrary(lib); + } + return result; +} + } // namespace namespace gfx { +float GetModernUIScale() { + return GetModernUIScaleWrapper(); +} + void InitDeviceScaleFactor(float scale) { DCHECK_NE(0.0f, scale); g_device_scale_factor = scale; @@ -163,7 +183,6 @@ double GetUndocumentedDPIScale() { return scale; } - double GetUndocumentedDPITouchScale() { static double scale = (base::win::GetVersion() < base::win::VERSION_WIN8_1) ? @@ -171,6 +190,5 @@ double GetUndocumentedDPITouchScale() { return scale; } - } // namespace win } // namespace gfx diff --git a/ui/gfx/win/dpi.h b/ui/gfx/win/dpi.h index 0193ac0..772944f 100644 --- a/ui/gfx/win/dpi.h +++ b/ui/gfx/win/dpi.h @@ -22,9 +22,14 @@ GFX_EXPORT void InitDeviceScaleFactor(float scale); GFX_EXPORT Size GetDPI(); // Gets the scale factor of the display. For example, if the display DPI is -// 96 then the scale factor is 1.0. +// 96 then the scale factor is 1.0. Note that this is the "desktop" scale, which +// may be differnt than GetModernUIScale(). GFX_EXPORT float GetDPIScale(); +// Gets the scale factor of the modern (metro) UI display. Returns 1.0 for +// unscaled or "not running on win8+" +GFX_EXPORT float GetModernUIScale(); + // Tests to see if the command line flag "--high-dpi-support" is set. GFX_EXPORT bool IsHighDPIEnabled(); |