Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(440)

Unified Diff: ui/gfx/win/dpi.cc

Issue 271543009: Send the device scale factor from Windows 8 ASH during initialization via the MetroViewerHostMsg_Se… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed tabs Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/win/dpi.h ('k') | ui/metro_viewer/metro_viewer_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/win/dpi.cc
diff --git a/ui/gfx/win/dpi.cc b/ui/gfx/win/dpi.cc
index 1afd5156b8d3c8338f999862cf3bd5c1553d30e3..374a2058e140a4c9b5345c988daf3ed4599e9076 100644
--- a/ui/gfx/win/dpi.cc
+++ b/ui/gfx/win/dpi.cc
@@ -38,29 +38,16 @@ BOOL IsProcessDPIAwareWrapper() {
float g_device_scale_factor = 0.0f;
float GetUnforcedDeviceScaleFactor() {
+ // If the global device scale factor is initialized use it. This is to ensure
+ // we use the same scale factor across all callsites. We don't use the
+ // GetDeviceScaleFactor function here because it fires a DCHECK if the
+ // g_device_scale_factor global is 0.
+ if (g_device_scale_factor)
+ return g_device_scale_factor;
return static_cast<float>(gfx::GetDPI().width()) /
static_cast<float>(kDefaultDPIX);
}
-float GetModernUIScaleWrapper() {
- float result = 1.0f;
- // TODO(cpu) : Fix scale for Win7.
- if (base::win::GetVersion() < base::win::VERSION_WIN8)
- return result;
-
- 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;
-}
-
// Duplicated from Win8.1 SDK ShellScalingApi.h
typedef enum PROCESS_DPI_AWARENESS {
PROCESS_DPI_UNAWARE = 0,
@@ -126,10 +113,6 @@ DWORD ReadRegistryValue(HKEY root,
namespace gfx {
-float GetModernUIScale() {
- return GetModernUIScaleWrapper();
-}
-
void InitDeviceScaleFactor(float scale) {
DCHECK_NE(0.0f, scale);
g_device_scale_factor = scale;
« no previous file with comments | « ui/gfx/win/dpi.h ('k') | ui/metro_viewer/metro_viewer_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698