| 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/display/win/screen_win.h" | 5 #include "ui/display/win/screen_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shellscalingapi.h> | 8 #include <shellscalingapi.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 namespace display { | 28 namespace display { |
| 29 namespace win { | 29 namespace win { |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 // TODO(robliao): http://crbug.com/615514 Remove when ScreenWin usage is | 32 // TODO(robliao): http://crbug.com/615514 Remove when ScreenWin usage is |
| 33 // resolved with Desktop Aura and WindowTreeHost. | 33 // resolved with Desktop Aura and WindowTreeHost. |
| 34 ScreenWin* g_screen_win_instance = nullptr; | 34 ScreenWin* g_screen_win_instance = nullptr; |
| 35 | 35 |
| 36 float GetMonitorScaleFactor(HMONITOR monitor) { | 36 float GetMonitorScaleFactor(HMONITOR monitor) { |
| 37 DCHECK(monitor); | 37 DCHECK(monitor); |
| 38 if (display::Display::HasForceDeviceScaleFactor()) |
| 39 return display::Display::GetForcedDeviceScaleFactor(); |
| 40 |
| 38 if (base::win::IsProcessPerMonitorDpiAware()) { | 41 if (base::win::IsProcessPerMonitorDpiAware()) { |
| 39 static auto get_dpi_for_monitor_func = [](){ | 42 static auto get_dpi_for_monitor_func = [](){ |
| 40 using GetDpiForMonitorPtr = decltype(::GetDpiForMonitor)*; | 43 using GetDpiForMonitorPtr = decltype(::GetDpiForMonitor)*; |
| 41 HMODULE shcore_dll = ::LoadLibrary(L"shcore.dll"); | 44 HMODULE shcore_dll = ::LoadLibrary(L"shcore.dll"); |
| 42 if (shcore_dll) { | 45 if (shcore_dll) { |
| 43 return reinterpret_cast<GetDpiForMonitorPtr>( | 46 return reinterpret_cast<GetDpiForMonitorPtr>( |
| 44 ::GetProcAddress(shcore_dll, "GetDpiForMonitor")); | 47 ::GetProcAddress(shcore_dll, "GetDpiForMonitor")); |
| 45 } | 48 } |
| 46 return static_cast<GetDpiForMonitorPtr>(nullptr); | 49 return static_cast<GetDpiForMonitorPtr>(nullptr); |
| 47 }(); | 50 }(); |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 if (std::find(unique_scale_factors.begin(), unique_scale_factors.end(), | 565 if (std::find(unique_scale_factors.begin(), unique_scale_factors.end(), |
| 563 reported_scale) == unique_scale_factors.end()) { | 566 reported_scale) == unique_scale_factors.end()) { |
| 564 unique_scale_factors.push_back(reported_scale); | 567 unique_scale_factors.push_back(reported_scale); |
| 565 UMA_HISTOGRAM_SPARSE_SLOWLY("UI.DeviceScale", reported_scale); | 568 UMA_HISTOGRAM_SPARSE_SLOWLY("UI.DeviceScale", reported_scale); |
| 566 } | 569 } |
| 567 } | 570 } |
| 568 } | 571 } |
| 569 | 572 |
| 570 } // namespace win | 573 } // namespace win |
| 571 } // namespace display | 574 } // namespace display |
| OLD | NEW |