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

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

Issue 24175004: Remove dependency on ui::ScaleFactor from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename methods and vars to make image_scale more clear Created 7 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 | Annotate | Revision Log
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 22 matching lines...) Expand all
33 } 33 }
34 34
35 // Gets the device scale factor. If support is enabled, this will return the 35 // Gets the device scale factor. If support is enabled, this will return the
36 // best available scale based on the screen's pixel density. This can be 36 // best available scale based on the screen's pixel density. This can be
37 // affected (overridden) by --force-device-scale-factor=x 37 // affected (overridden) by --force-device-scale-factor=x
38 float GetDeviceScaleFactorImpl() { 38 float GetDeviceScaleFactorImpl() {
39 if (IsHighDPIEnabled()) { 39 if (IsHighDPIEnabled()) {
40 float scale = gfx::Display::HasForceDeviceScaleFactor() ? 40 float scale = gfx::Display::HasForceDeviceScaleFactor() ?
41 gfx::Display::GetForcedDeviceScaleFactor() : gfx::GetDPIScale(); 41 gfx::Display::GetForcedDeviceScaleFactor() : gfx::GetDPIScale();
42 // Quantize to nearest supported scale factor. 42 // Quantize to nearest supported scale factor.
43 scale = ui::GetScaleFactorScale(ui::GetScaleFactorFromScale(scale)); 43 scale = ui::GetImageScale(ui::GetSupportedScaleFactor(scale));
44 return scale; 44 return scale;
45 } 45 }
46 return 1.0f; 46 return 1.0f;
47 } 47 }
48 48
49 BOOL IsProcessDPIAwareWrapper() { 49 BOOL IsProcessDPIAwareWrapper() {
50 typedef BOOL(WINAPI *IsProcessDPIAwarePtr)(VOID); 50 typedef BOOL(WINAPI *IsProcessDPIAwarePtr)(VOID);
51 IsProcessDPIAwarePtr is_process_dpi_aware_func = 51 IsProcessDPIAwarePtr is_process_dpi_aware_func =
52 reinterpret_cast<IsProcessDPIAwarePtr>( 52 reinterpret_cast<IsProcessDPIAwarePtr>(
53 GetProcAddress(GetModuleHandleA("user32.dll"), "IsProcessDPIAware")); 53 GetProcAddress(GetModuleHandleA("user32.dll"), "IsProcessDPIAware"));
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 double GetUndocumentedDPITouchScale() { 166 double GetUndocumentedDPITouchScale() {
167 static double scale = 167 static double scale =
168 (base::win::GetVersion() < base::win::VERSION_WIN8_1) ? 168 (base::win::GetVersion() < base::win::VERSION_WIN8_1) ?
169 GetUndocumentedDPIScale() : 1.0; 169 GetUndocumentedDPIScale() : 1.0;
170 return scale; 170 return scale;
171 } 171 }
172 172
173 173
174 } // namespace win 174 } // namespace win
175 } // namespace gfx 175 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698