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

Unified Diff: ui/base/win/dpi.cc

Issue 16196008: Add HiDPI flag for Windows (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/ui_base_switches.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/win/dpi.cc
diff --git a/ui/base/win/dpi.cc b/ui/base/win/dpi.cc
index 75d63bba3d48935827702617c54e05deb0f06e18..2cef96e4ce131017c7bdb488860ffbe75c25dff0 100644
--- a/ui/base/win/dpi.cc
+++ b/ui/base/win/dpi.cc
@@ -5,10 +5,11 @@
#include "ui/base/win/dpi.h"
#include <windows.h>
-
+#include "base/command_line.h"
#include "base/win/scoped_hdc.h"
#include "ui/base/layout.h"
#include "base/win/registry.h"
+#include "ui/base/ui_base_switches.h"
#include "ui/gfx/display.h"
#include "ui/gfx/point_conversions.h"
#include "ui/gfx/rect_conversions.h"
@@ -19,16 +20,26 @@ namespace {
int kDefaultDPIX = 96;
int kDefaultDPIY = 96;
+bool IsHighDPIEnabled() {
+ // Default is disabled.
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kHighDPISupport)) {
+ return CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kHighDPISupport).compare("1") == 0;
+ }
+ return false;
+}
+
float GetDeviceScaleFactorImpl() {
#if defined(ENABLE_HIDPI)
- float scale = gfx::Display::HasForceDeviceScaleFactor() ?
- gfx::Display::GetForcedDeviceScaleFactor() : ui::GetDPIScale();
- // Quantize to nearest supported scale factor.
- scale = ui::GetScaleFactorScale(ui::GetScaleFactorFromScale(scale));
- return scale;
-#else
- return 1.0f;
+ if (IsHighDPIEnabled()) {
+ float scale = gfx::Display::HasForceDeviceScaleFactor() ?
+ gfx::Display::GetForcedDeviceScaleFactor() : ui::GetDPIScale();
+ // Quantize to nearest supported scale factor.
+ scale = ui::GetScaleFactorScale(ui::GetScaleFactorFromScale(scale));
+ return scale;
+ }
#endif
+ return 1.0f;
}
BOOL IsProcessDPIAwareWrapper() {
« no previous file with comments | « ui/base/ui_base_switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698