| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 g_has_forced_device_scale_factor = HasForceDeviceScaleFactorImpl(); | 66 g_has_forced_device_scale_factor = HasForceDeviceScaleFactorImpl(); |
| 67 return !!g_has_forced_device_scale_factor; | 67 return !!g_has_forced_device_scale_factor; |
| 68 } | 68 } |
| 69 | 69 |
| 70 // static | 70 // static |
| 71 void Display::ResetForceDeviceScaleFactorForTesting() { | 71 void Display::ResetForceDeviceScaleFactorForTesting() { |
| 72 g_has_forced_device_scale_factor = -1; | 72 g_has_forced_device_scale_factor = -1; |
| 73 g_forced_device_scale_factor = -1.0; | 73 g_forced_device_scale_factor = -1.0; |
| 74 } | 74 } |
| 75 | 75 |
| 76 constexpr int DEFAULT_BITS_PER_PIXEL = 24; |
| 77 constexpr int DEFAULT_BITS_PER_COMPONENT = 8; |
| 78 |
| 76 Display::Display() | 79 Display::Display() |
| 77 : id_(kInvalidDisplayID), | 80 : id_(kInvalidDisplayID), |
| 78 device_scale_factor_(GetForcedDeviceScaleFactor()), | 81 device_scale_factor_(GetForcedDeviceScaleFactor()), |
| 79 rotation_(ROTATE_0), | 82 rotation_(ROTATE_0), |
| 80 touch_support_(TOUCH_SUPPORT_UNKNOWN) {} | 83 touch_support_(TOUCH_SUPPORT_UNKNOWN), |
| 84 color_depth_(DEFAULT_BITS_PER_PIXEL), |
| 85 depth_per_component_(DEFAULT_BITS_PER_COMPONENT) {} |
| 81 | 86 |
| 82 Display::Display(const Display& other) = default; | 87 Display::Display(const Display& other) = default; |
| 83 | 88 |
| 84 Display::Display(int64_t id) | 89 Display::Display(int64_t id) |
| 85 : id_(id), | 90 : id_(id), |
| 86 device_scale_factor_(GetForcedDeviceScaleFactor()), | 91 device_scale_factor_(GetForcedDeviceScaleFactor()), |
| 87 rotation_(ROTATE_0), | 92 rotation_(ROTATE_0), |
| 88 touch_support_(TOUCH_SUPPORT_UNKNOWN) {} | 93 touch_support_(TOUCH_SUPPORT_UNKNOWN), |
| 94 color_depth_(DEFAULT_BITS_PER_PIXEL), |
| 95 depth_per_component_(DEFAULT_BITS_PER_COMPONENT) {} |
| 89 | 96 |
| 90 Display::Display(int64_t id, const gfx::Rect& bounds) | 97 Display::Display(int64_t id, const gfx::Rect& bounds) |
| 91 : id_(id), | 98 : id_(id), |
| 92 bounds_(bounds), | 99 bounds_(bounds), |
| 93 work_area_(bounds), | 100 work_area_(bounds), |
| 94 device_scale_factor_(GetForcedDeviceScaleFactor()), | 101 device_scale_factor_(GetForcedDeviceScaleFactor()), |
| 95 rotation_(ROTATE_0), | 102 rotation_(ROTATE_0), |
| 96 touch_support_(TOUCH_SUPPORT_UNKNOWN) { | 103 touch_support_(TOUCH_SUPPORT_UNKNOWN), |
| 104 color_depth_(DEFAULT_BITS_PER_PIXEL), |
| 105 depth_per_component_(DEFAULT_BITS_PER_COMPONENT) { |
| 97 #if defined(USE_AURA) | 106 #if defined(USE_AURA) |
| 98 SetScaleAndBounds(device_scale_factor_, bounds); | 107 SetScaleAndBounds(device_scale_factor_, bounds); |
| 99 #endif | 108 #endif |
| 100 } | 109 } |
| 101 | 110 |
| 102 Display::~Display() {} | 111 Display::~Display() {} |
| 103 | 112 |
| 104 int Display::RotationAsDegree() const { | 113 int Display::RotationAsDegree() const { |
| 105 switch (rotation_) { | 114 switch (rotation_) { |
| 106 case ROTATE_0: | 115 case ROTATE_0: |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 DCHECK_NE(kInvalidDisplayID, display_id); | 215 DCHECK_NE(kInvalidDisplayID, display_id); |
| 207 return HasInternalDisplay() && internal_display_id_ == display_id; | 216 return HasInternalDisplay() && internal_display_id_ == display_id; |
| 208 } | 217 } |
| 209 | 218 |
| 210 // static | 219 // static |
| 211 bool Display::HasInternalDisplay() { | 220 bool Display::HasInternalDisplay() { |
| 212 return internal_display_id_ != kInvalidDisplayID; | 221 return internal_display_id_ != kInvalidDisplayID; |
| 213 } | 222 } |
| 214 | 223 |
| 215 } // namespace display | 224 } // namespace display |
| OLD | NEW |