OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/display/display_change_observer_chromeos.h" | 5 #include "ash/display/display_change_observer_chromeos.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 display_mode_it->second = display_mode; | 129 display_mode_it->second = display_mode; |
130 } | 130 } |
131 | 131 |
132 std::vector<DisplayMode> display_mode_list; | 132 std::vector<DisplayMode> display_mode_list; |
133 for (DisplayModeMap::const_iterator iter = display_mode_map.begin(); | 133 for (DisplayModeMap::const_iterator iter = display_mode_map.begin(); |
134 iter != display_mode_map.end(); | 134 iter != display_mode_map.end(); |
135 ++iter) { | 135 ++iter) { |
136 display_mode_list.push_back(iter->second); | 136 display_mode_list.push_back(iter->second); |
137 } | 137 } |
138 | 138 |
| 139 if (output.display->native_mode()) { |
| 140 const std::pair<int, int> size(native_mode.size.width(), |
| 141 native_mode.size.height()); |
| 142 DisplayModeMap::iterator it = display_mode_map.find(size); |
| 143 DCHECK(it != display_mode_map.end()) |
| 144 << "Native mode must be part of the mode list."; |
| 145 |
| 146 // If the native mode was replaced re-add it. |
| 147 if (!it->second.native) |
| 148 display_mode_list.push_back(native_mode); |
| 149 } |
| 150 |
139 if (native_mode.size.width() >= kMinimumWidthFor4K) { | 151 if (native_mode.size.width() >= kMinimumWidthFor4K) { |
140 for (size_t i = 0; i < arraysize(kAdditionalDeviceScaleFactorsFor4k); | 152 for (size_t i = 0; i < arraysize(kAdditionalDeviceScaleFactorsFor4k); |
141 ++i) { | 153 ++i) { |
142 DisplayMode mode = native_mode; | 154 DisplayMode mode = native_mode; |
143 mode.device_scale_factor = kAdditionalDeviceScaleFactorsFor4k[i]; | 155 mode.device_scale_factor = kAdditionalDeviceScaleFactorsFor4k[i]; |
144 mode.native = false; | 156 mode.native = false; |
145 display_mode_list.push_back(mode); | 157 display_mode_list.push_back(mode); |
146 } | 158 } |
147 } | 159 } |
148 | 160 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 } | 286 } |
275 return 1.0f; | 287 return 1.0f; |
276 } | 288 } |
277 | 289 |
278 void DisplayChangeObserver::OnInputDeviceConfigurationChanged() { | 290 void DisplayChangeObserver::OnInputDeviceConfigurationChanged() { |
279 OnDisplayModeChanged( | 291 OnDisplayModeChanged( |
280 Shell::GetInstance()->display_configurator()->cached_displays()); | 292 Shell::GetInstance()->display_configurator()->cached_displays()); |
281 } | 293 } |
282 | 294 |
283 } // namespace ash | 295 } // namespace ash |
OLD | NEW |