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

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

Issue 516743002: Force scales 125% and lower down to 100% (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 3 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 | « no previous file | 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // user must logout to change the DPI setting. This value also applies 127 // user must logout to change the DPI setting. This value also applies
128 // to all screens. 128 // to all screens.
129 dpi_x = GetDeviceCaps(screen_dc, LOGPIXELSX); 129 dpi_x = GetDeviceCaps(screen_dc, LOGPIXELSX);
130 dpi_y = GetDeviceCaps(screen_dc, LOGPIXELSY); 130 dpi_y = GetDeviceCaps(screen_dc, LOGPIXELSY);
131 } 131 }
132 return Size(dpi_x, dpi_y); 132 return Size(dpi_x, dpi_y);
133 } 133 }
134 134
135 float GetDPIScale() { 135 float GetDPIScale() {
136 if (IsHighDPIEnabled()) { 136 if (IsHighDPIEnabled()) {
137 if (GetDPI().width() <= 120) {
sky 2014/08/28 23:23:29 Add a comment as to why we do this.
scottmg 2014/08/28 23:29:22 Done.
138 // 120 logical pixels is 125% scale.
139 return 1.0;
140 }
137 return gfx::Display::HasForceDeviceScaleFactor() ? 141 return gfx::Display::HasForceDeviceScaleFactor() ?
138 gfx::Display::GetForcedDeviceScaleFactor() : 142 gfx::Display::GetForcedDeviceScaleFactor() :
139 GetUnforcedDeviceScaleFactor(); 143 GetUnforcedDeviceScaleFactor();
140 } 144 }
141 return 1.0; 145 return 1.0;
142 } 146 }
143 147
144 void ForceHighDPISupportForTesting(float scale) { 148 void ForceHighDPISupportForTesting(float scale) {
145 g_device_scale_factor = scale; 149 g_device_scale_factor = scale;
146 } 150 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 return static_cast<int>(GetSystemMetrics(metric) / 223 return static_cast<int>(GetSystemMetrics(metric) /
220 GetDeviceScaleFactor() + 0.5); 224 GetDeviceScaleFactor() + 0.5);
221 } 225 }
222 226
223 bool IsDeviceScaleFactorSet() { 227 bool IsDeviceScaleFactorSet() {
224 return g_device_scale_factor != 0.0f; 228 return g_device_scale_factor != 0.0f;
225 } 229 }
226 230
227 } // namespace win 231 } // namespace win
228 } // namespace gfx 232 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698