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 ui::DisplayMode& native_mode = *output.display->native_mode(); | |
141 const std::pair<int, int> size(native_mode.size().width(), | |
142 native_mode.size().height()); | |
143 DisplayModeMap::iterator it = display_mode_map.find(size); | |
144 DCHECK(it != display_mode_map.end()) | |
145 << "Native mode must be part of the mode list."; | |
146 | |
147 // If the native mode wasn't added or was replaced re-add it. | |
148 if (!it->second.native) | |
149 display_mode_list.push_back(DisplayMode(native_mode.size(), | |
Jun Mukai
2014/10/08 19:41:53
why not simply pushing |native_mode| here?
dnicoara
2014/10/08 19:50:43
Arr, right, sorry, completely missed that it was t
| |
150 native_mode.refresh_rate(), | |
151 native_mode.is_interlaced(), | |
152 true)); | |
153 } | |
154 | |
139 if (native_mode.size.width() >= kMinimumWidthFor4K) { | 155 if (native_mode.size.width() >= kMinimumWidthFor4K) { |
140 for (size_t i = 0; i < arraysize(kAdditionalDeviceScaleFactorsFor4k); | 156 for (size_t i = 0; i < arraysize(kAdditionalDeviceScaleFactorsFor4k); |
141 ++i) { | 157 ++i) { |
142 DisplayMode mode = native_mode; | 158 DisplayMode mode = native_mode; |
143 mode.device_scale_factor = kAdditionalDeviceScaleFactorsFor4k[i]; | 159 mode.device_scale_factor = kAdditionalDeviceScaleFactorsFor4k[i]; |
144 mode.native = false; | 160 mode.native = false; |
145 display_mode_list.push_back(mode); | 161 display_mode_list.push_back(mode); |
146 } | 162 } |
147 } | 163 } |
148 | 164 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
274 } | 290 } |
275 return 1.0f; | 291 return 1.0f; |
276 } | 292 } |
277 | 293 |
278 void DisplayChangeObserver::OnInputDeviceConfigurationChanged() { | 294 void DisplayChangeObserver::OnInputDeviceConfigurationChanged() { |
279 OnDisplayModeChanged( | 295 OnDisplayModeChanged( |
280 Shell::GetInstance()->display_configurator()->cached_displays()); | 296 Shell::GetInstance()->display_configurator()->cached_displays()); |
281 } | 297 } |
282 | 298 |
283 } // namespace ash | 299 } // namespace ash |
OLD | NEW |