From 40bd0e2dbb489669dedd5eaab25f1dee629e9b09 Mon Sep 17 00:00:00 2001 From: "girard@chromium.org" Date: Fri, 22 Nov 2013 13:22:59 +0000 Subject: 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 --- ui/gfx/win/dpi.cc | 22 ++++++++++++++++++++-- ui/gfx/win/dpi.h | 7 ++++++- 2 files changed, 26 insertions(+), 3 deletions(-) (limited to 'ui') 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(gfx::GetDPI().width()) / static_cast(kDefaultDPIX); } + +float GetModernUIScaleWrapper() { + float result = 1.0f; + typedef float(WINAPI *GetModernUIScalePtr)(VOID); + HMODULE lib = LoadLibraryA("metro_driver.dll"); + if (lib) { + GetModernUIScalePtr func = + reinterpret_cast( + 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(); -- cgit v1.1