| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gfx/win/dpi.h" | 5 #include "ui/gfx/win/dpi.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/win/scoped_hdc.h" | 9 #include "base/win/scoped_hdc.h" |
| 10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 float g_device_scale_factor = 0.0f; | 38 float g_device_scale_factor = 0.0f; |
| 39 | 39 |
| 40 float GetUnforcedDeviceScaleFactor() { | 40 float GetUnforcedDeviceScaleFactor() { |
| 41 return static_cast<float>(gfx::GetDPI().width()) / | 41 return static_cast<float>(gfx::GetDPI().width()) / |
| 42 static_cast<float>(kDefaultDPIX); | 42 static_cast<float>(kDefaultDPIX); |
| 43 } | 43 } |
| 44 | 44 |
| 45 float GetModernUIScaleWrapper() { | 45 float GetModernUIScaleWrapper() { |
| 46 float result = 1.0f; | 46 float result = 1.0f; |
| 47 // TODO(cpu) : Fix scale for Win7. |
| 48 if (base::win::GetVersion() < base::win::VERSION_WIN8) |
| 49 return result; |
| 50 |
| 47 typedef float(WINAPI *GetModernUIScalePtr)(VOID); | 51 typedef float(WINAPI *GetModernUIScalePtr)(VOID); |
| 48 HMODULE lib = LoadLibraryA("metro_driver.dll"); | 52 HMODULE lib = LoadLibraryA("metro_driver.dll"); |
| 49 if (lib) { | 53 if (lib) { |
| 50 GetModernUIScalePtr func = | 54 GetModernUIScalePtr func = |
| 51 reinterpret_cast<GetModernUIScalePtr>( | 55 reinterpret_cast<GetModernUIScalePtr>( |
| 52 GetProcAddress(lib, "GetModernUIScale")); | 56 GetProcAddress(lib, "GetModernUIScale")); |
| 53 if (func) | 57 if (func) |
| 54 result = func(); | 58 result = func(); |
| 55 FreeLibrary(lib); | 59 FreeLibrary(lib); |
| 56 } | 60 } |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 263 |
| 260 double GetUndocumentedDPITouchScale() { | 264 double GetUndocumentedDPITouchScale() { |
| 261 static double scale = | 265 static double scale = |
| 262 (base::win::GetVersion() < base::win::VERSION_WIN8_1) ? | 266 (base::win::GetVersion() < base::win::VERSION_WIN8_1) ? |
| 263 GetUndocumentedDPIScale() : 1.0; | 267 GetUndocumentedDPIScale() : 1.0; |
| 264 return scale; | 268 return scale; |
| 265 } | 269 } |
| 266 | 270 |
| 267 } // namespace win | 271 } // namespace win |
| 268 } // namespace gfx | 272 } // namespace gfx |
| OLD | NEW |