Chromium Code Reviews| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 scale_in_double = 1.0; | 52 scale_in_double = 1.0; |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 return static_cast<float>(scale_in_double); | 55 return static_cast<float>(scale_in_double); |
| 56 } | 56 } |
| 57 | 57 |
| 58 int64_t internal_display_id_ = -1; | 58 int64_t internal_display_id_ = -1; |
| 59 | 59 |
| 60 } // namespace | 60 } // namespace |
| 61 | 61 |
| 62 bool CompareDisplayIds(int64_t id1, int64_t id2) { | |
| 63 DCHECK_NE(id1, id2); | |
|
Nico
2017/07/28 21:09:58
This DCHECK is not correct. You're passing this to
| |
| 64 // Output index is stored in the first 8 bits. See GetDisplayIdFromEDID | |
| 65 // in edid_parser.cc. | |
| 66 int index_1 = id1 & 0xFF; | |
| 67 int index_2 = id2 & 0xFF; | |
| 68 DCHECK_NE(index_1, index_2) << id1 << " and " << id2; | |
| 69 return Display::IsInternalDisplayId(id1) || | |
| 70 (index_1 < index_2 && !Display::IsInternalDisplayId(id2)); | |
| 71 } | |
| 72 | |
| 62 // static | 73 // static |
| 63 float Display::GetForcedDeviceScaleFactor() { | 74 float Display::GetForcedDeviceScaleFactor() { |
| 64 if (g_forced_device_scale_factor < 0) | 75 if (g_forced_device_scale_factor < 0) |
| 65 g_forced_device_scale_factor = GetForcedDeviceScaleFactorImpl(); | 76 g_forced_device_scale_factor = GetForcedDeviceScaleFactorImpl(); |
| 66 return g_forced_device_scale_factor; | 77 return g_forced_device_scale_factor; |
| 67 } | 78 } |
| 68 | 79 |
| 69 // static | 80 // static |
| 70 bool Display::HasForceDeviceScaleFactor() { | 81 bool Display::HasForceDeviceScaleFactor() { |
| 71 if (g_has_forced_device_scale_factor == -1) | 82 if (g_has_forced_device_scale_factor == -1) |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 DCHECK_NE(kInvalidDisplayId, display_id); | 225 DCHECK_NE(kInvalidDisplayId, display_id); |
| 215 return HasInternalDisplay() && internal_display_id_ == display_id; | 226 return HasInternalDisplay() && internal_display_id_ == display_id; |
| 216 } | 227 } |
| 217 | 228 |
| 218 // static | 229 // static |
| 219 bool Display::HasInternalDisplay() { | 230 bool Display::HasInternalDisplay() { |
| 220 return internal_display_id_ != kInvalidDisplayId; | 231 return internal_display_id_ != kInvalidDisplayId; |
| 221 } | 232 } |
| 222 | 233 |
| 223 } // namespace display | 234 } // namespace display |
| OLD | NEW |