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/win/scoped_hdc.h" | 8 #include "base/win/scoped_hdc.h" |
9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
10 #include "base/win/registry.h" | 10 #include "base/win/registry.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 bool IsHighDPIEnabled() { | 152 bool IsHighDPIEnabled() { |
153 // Flag stored in HKEY_CURRENT_USER\SOFTWARE\\Google\\Chrome\\Profile, | 153 // Flag stored in HKEY_CURRENT_USER\SOFTWARE\\Google\\Chrome\\Profile, |
154 // under the DWORD value high-dpi-support. | 154 // under the DWORD value high-dpi-support. |
155 // Default is disabled. | 155 // Default is disabled. |
156 static DWORD value = ReadRegistryValue( | 156 static DWORD value = ReadRegistryValue( |
157 HKEY_CURRENT_USER, gfx::win::kRegistryProfilePath, | 157 HKEY_CURRENT_USER, gfx::win::kRegistryProfilePath, |
158 gfx::win::kHighDPISupportW, TRUE); | 158 gfx::win::kHighDPISupportW, TRUE); |
159 return value != 0; | 159 return value != 0; |
160 } | 160 } |
161 | 161 |
162 bool IsInHighDPIMode() { | |
163 return GetDPIScale() > 1.0; | |
164 } | |
165 | |
166 void EnableHighDPISupport() { | 162 void EnableHighDPISupport() { |
167 if (IsHighDPIEnabled() && | 163 if (IsHighDPIEnabled() && |
168 !SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) { | 164 !SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) { |
169 SetProcessDPIAwareWrapper(); | 165 SetProcessDPIAwareWrapper(); |
170 } | 166 } |
171 } | 167 } |
172 | 168 |
173 namespace win { | 169 namespace win { |
174 | 170 |
175 GFX_EXPORT const wchar_t kRegistryProfilePath[] = | 171 GFX_EXPORT const wchar_t kRegistryProfilePath[] = |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 return static_cast<int>(GetSystemMetrics(metric) / | 217 return static_cast<int>(GetSystemMetrics(metric) / |
222 GetDeviceScaleFactor() + 0.5); | 218 GetDeviceScaleFactor() + 0.5); |
223 } | 219 } |
224 | 220 |
225 bool IsDeviceScaleFactorSet() { | 221 bool IsDeviceScaleFactorSet() { |
226 return g_device_scale_factor != 0.0f; | 222 return g_device_scale_factor != 0.0f; |
227 } | 223 } |
228 | 224 |
229 } // namespace win | 225 } // namespace win |
230 } // namespace gfx | 226 } // namespace gfx |
OLD | NEW |