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

Side by Side Diff: ui/gfx/win/dpi.cc

Issue 232483005: Enable --high-dpi-support by default. Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Disabling broken unit tests. (Don't submit this code!) 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 unified diff | Download patch
« no previous file with comments | « ui/gfx/switches.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 float GetDPIScale() { 138 float GetDPIScale() {
139 if (IsHighDPIEnabled()) { 139 if (IsHighDPIEnabled()) {
140 return gfx::Display::HasForceDeviceScaleFactor() ? 140 return gfx::Display::HasForceDeviceScaleFactor() ?
141 gfx::Display::GetForcedDeviceScaleFactor() : 141 gfx::Display::GetForcedDeviceScaleFactor() :
142 GetUnforcedDeviceScaleFactor(); 142 GetUnforcedDeviceScaleFactor();
143 } 143 }
144 return 1.0; 144 return 1.0;
145 } 145 }
146 146
147 void ForceHighDPISupportForTesting(float scale) { 147 void ForceHighDPISupportForTesting(float scale) {
148 force_highdpi_for_testing = true;
149 g_device_scale_factor = scale; 148 g_device_scale_factor = scale;
150 } 149 }
151 150
152 bool IsHighDPIEnabled() { 151 bool IsHighDPIEnabled() {
153 // Flag stored in HKEY_CURRENT_USER\SOFTWARE\\Google\\Chrome\\Profile, 152 // Flag stored in HKEY_CURRENT_USER\SOFTWARE\\Google\\Chrome\\Profile,
154 // under the DWORD value high-dpi-support. 153 // under the DWORD value high-dpi-support.
155 // Default is disabled. 154 // Default is disabled.
156 static DWORD value = ReadRegistryValue( 155 static DWORD value = ReadRegistryValue(
157 HKEY_CURRENT_USER, kRegistryProfilePath, 156 HKEY_CURRENT_USER, kRegistryProfilePath,
158 kHighDPISupportW, FALSE); 157 kHighDPISupportW, TRUE);
159 return force_highdpi_for_testing || (value == 1); 158 return value != 0;
160 } 159 }
161 160
162 bool IsInHighDPIMode() { 161 bool IsInHighDPIMode() {
163 return GetDPIScale() > 1.0; 162 return GetDPIScale() > 1.0;
164 } 163 }
165 164
166 void EnableHighDPISupport() { 165 void EnableHighDPISupport() {
167 if (IsHighDPIEnabled() && 166 if (IsHighDPIEnabled() &&
168 !SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) { 167 !SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) {
169 SetProcessDPIAwareWrapper(); 168 SetProcessDPIAwareWrapper();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 241
243 double GetUndocumentedDPITouchScale() { 242 double GetUndocumentedDPITouchScale() {
244 static double scale = 243 static double scale =
245 (base::win::GetVersion() < base::win::VERSION_WIN8_1) ? 244 (base::win::GetVersion() < base::win::VERSION_WIN8_1) ?
246 GetUndocumentedDPIScale() : 1.0; 245 GetUndocumentedDPIScale() : 1.0;
247 return scale; 246 return scale;
248 } 247 }
249 248
250 } // namespace win 249 } // namespace win
251 } // namespace gfx 250 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698