| OLD | NEW |
| 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/display/display.h" | 5 #include "ui/display/display.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 g_has_forced_device_scale_factor = HasForceDeviceScaleFactorImpl(); | 83 g_has_forced_device_scale_factor = HasForceDeviceScaleFactorImpl(); |
| 84 return !!g_has_forced_device_scale_factor; | 84 return !!g_has_forced_device_scale_factor; |
| 85 } | 85 } |
| 86 | 86 |
| 87 // static | 87 // static |
| 88 void Display::ResetForceDeviceScaleFactorForTesting() { | 88 void Display::ResetForceDeviceScaleFactorForTesting() { |
| 89 g_has_forced_device_scale_factor = -1; | 89 g_has_forced_device_scale_factor = -1; |
| 90 g_forced_device_scale_factor = -1.0; | 90 g_forced_device_scale_factor = -1.0; |
| 91 } | 91 } |
| 92 | 92 |
| 93 // static |
| 94 void Display::SetForceDeviceScaleFactor(double dsf) { |
| 95 // Reset any previously set values and unset the flag. |
| 96 g_forced_device_scale_factor = -1.0; |
| 97 |
| 98 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 99 switches::kForceDeviceScaleFactor, base::StringPrintf("%.2f", dsf)); |
| 100 } |
| 101 |
| 93 Display::Display() : Display(kInvalidDisplayId) {} | 102 Display::Display() : Display(kInvalidDisplayId) {} |
| 94 | 103 |
| 95 Display::Display(int64_t id) : Display(id, gfx::Rect()) {} | 104 Display::Display(int64_t id) : Display(id, gfx::Rect()) {} |
| 96 | 105 |
| 97 Display::Display(int64_t id, const gfx::Rect& bounds) | 106 Display::Display(int64_t id, const gfx::Rect& bounds) |
| 98 : id_(id), | 107 : id_(id), |
| 99 bounds_(bounds), | 108 bounds_(bounds), |
| 100 work_area_(bounds), | 109 work_area_(bounds), |
| 101 device_scale_factor_(GetForcedDeviceScaleFactor()), | 110 device_scale_factor_(GetForcedDeviceScaleFactor()), |
| 102 color_depth_(DEFAULT_BITS_PER_PIXEL), | 111 color_depth_(DEFAULT_BITS_PER_PIXEL), |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 DCHECK_NE(kInvalidDisplayId, display_id); | 234 DCHECK_NE(kInvalidDisplayId, display_id); |
| 226 return HasInternalDisplay() && internal_display_id_ == display_id; | 235 return HasInternalDisplay() && internal_display_id_ == display_id; |
| 227 } | 236 } |
| 228 | 237 |
| 229 // static | 238 // static |
| 230 bool Display::HasInternalDisplay() { | 239 bool Display::HasInternalDisplay() { |
| 231 return internal_display_id_ != kInvalidDisplayId; | 240 return internal_display_id_ != kInvalidDisplayId; |
| 232 } | 241 } |
| 233 | 242 |
| 234 } // namespace display | 243 } // namespace display |
| OLD | NEW |