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

Unified Diff: ui/gfx/display.cc

Issue 10546158: Remove --default-device-scale-factor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 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/gfx/display.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/display.cc
diff --git a/ui/gfx/display.cc b/ui/gfx/display.cc
index 451cb84ef04a3a7b622317882a1dab7ac8f3f229..110fe6e0edc4ddb6a211f5a4a8312594e524ddeb 100644
--- a/ui/gfx/display.cc
+++ b/ui/gfx/display.cc
@@ -14,12 +14,16 @@
namespace gfx {
namespace {
-float GetDefaultDeviceScaleFactorImpl() {
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+bool HasForceDeviceScaleFactor() {
+ return CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kForceDeviceScaleFactor);
+}
+
+float GetForcedDeviceScaleFactorImpl() {
double scale_in_double = 1.0;
- if (command_line.HasSwitch(switches::kDefaultDeviceScaleFactor)) {
- std::string value =
- command_line.GetSwitchValueASCII(switches::kDefaultDeviceScaleFactor);
+ if (HasForceDeviceScaleFactor()) {
+ std::string value = CommandLine::ForCurrentProcess()->
+ GetSwitchValueASCII(switches::kForceDeviceScaleFactor);
if (!base::StringToDouble(value, &scale_in_double))
LOG(ERROR) << "Failed to parse the deafult device scale factor:" << value;
}
@@ -29,27 +33,27 @@ float GetDefaultDeviceScaleFactorImpl() {
} // namespace
// static
-float Display::GetDefaultDeviceScaleFactor() {
- static const float kDefaultDeviceScaleFactor =
- GetDefaultDeviceScaleFactorImpl();
- return kDefaultDeviceScaleFactor;
+float Display::GetForcedDeviceScaleFactor() {
+ static const float kForcedDeviceScaleFactor =
+ GetForcedDeviceScaleFactorImpl();
+ return kForcedDeviceScaleFactor;
}
Display::Display()
: id_(-1),
- device_scale_factor_(GetDefaultDeviceScaleFactor()) {
+ device_scale_factor_(GetForcedDeviceScaleFactor()) {
}
Display::Display(int id)
: id_(id),
- device_scale_factor_(GetDefaultDeviceScaleFactor()) {
+ device_scale_factor_(GetForcedDeviceScaleFactor()) {
}
Display::Display(int id, const gfx::Rect& bounds)
: id_(id),
bounds_(bounds),
work_area_(bounds),
- device_scale_factor_(GetDefaultDeviceScaleFactor()) {
+ device_scale_factor_(GetForcedDeviceScaleFactor()) {
#if defined(USE_AURA)
SetScaleAndBounds(device_scale_factor_, bounds);
#endif
@@ -69,7 +73,8 @@ void Display::SetScaleAndBounds(
float device_scale_factor,
const gfx::Rect& bounds_in_pixel) {
Insets insets = bounds_.InsetsFrom(work_area_);
- device_scale_factor_ = device_scale_factor;
+ if (!HasForceDeviceScaleFactor())
+ device_scale_factor_ = device_scale_factor;
#if defined(USE_AURA)
bounds_in_pixel_ = bounds_in_pixel;
#endif
« no previous file with comments | « ui/gfx/display.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698