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 "ash/display/multi_display_manager.h" | 5 #include "ash/display/multi_display_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 iter != displays_.end(); ++iter) { | 141 iter != displays_.end(); ++iter) { |
142 const gfx::Display& display = *iter; | 142 const gfx::Display& display = *iter; |
143 if (display.bounds().Contains(point_in_screen)) | 143 if (display.bounds().Contains(point_in_screen)) |
144 return display; | 144 return display; |
145 } | 145 } |
146 return GetInvalidDisplay(); | 146 return GetInvalidDisplay(); |
147 } | 147 } |
148 | 148 |
149 void MultiDisplayManager::SetOverscanInsets(int64 display_id, | 149 void MultiDisplayManager::SetOverscanInsets(int64 display_id, |
150 const gfx::Insets& insets_in_dip) { | 150 const gfx::Insets& insets_in_dip) { |
151 std::map<int64, gfx::Insets>::const_iterator old_overscan = | |
152 overscan_mapping_.find(display_id); | |
153 if (old_overscan != overscan_mapping_.end()) { | |
154 gfx::Insets old_insets = old_overscan->second; | |
155 for (DisplayList::iterator iter = displays_.begin(); | |
oshima
2012/10/16 23:54:17
FindDisplayForId
Jun Mukai
2012/10/17 00:07:49
Thanks. But as far as I see, it returns a const r
oshima
2012/10/17 01:09:40
FindDisplayId returns non const reference. GetDisp
Jun Mukai
2012/10/17 15:45:46
Done.
| |
156 iter != displays_.end(); ++iter) { | |
157 if (iter->id() == display_id) { | |
158 // Reimburse the existing insets before applying the new insets. | |
159 gfx::Rect bounds = iter->bounds_in_pixel(); | |
160 gfx::Insets negated_insets = old_insets.Scale(-1); | |
161 bounds.Inset(negated_insets.Scale(iter->device_scale_factor())); | |
oshima
2012/10/16 23:54:17
Scale(- iter->device_scale_factor()); (or -1 *)
Jun Mukai
2012/10/17 00:07:49
Done.
| |
162 iter->SetScaleAndBounds(iter->device_scale_factor(), bounds); | |
163 break; | |
164 } | |
165 } | |
166 } | |
151 overscan_mapping_[display_id] = insets_in_dip; | 167 overscan_mapping_[display_id] = insets_in_dip; |
152 OnNativeDisplaysChanged(displays_); | 168 OnNativeDisplaysChanged(displays_); |
153 } | 169 } |
154 | 170 |
155 void MultiDisplayManager::OnNativeDisplaysChanged( | 171 void MultiDisplayManager::OnNativeDisplaysChanged( |
156 const std::vector<gfx::Display>& updated_displays) { | 172 const std::vector<gfx::Display>& updated_displays) { |
157 if (updated_displays.empty()) { | 173 if (updated_displays.empty()) { |
158 // Don't update the displays when all displays are disconnected. | 174 // Don't update the displays when all displays are disconnected. |
159 // This happens when: | 175 // This happens when: |
160 // - the device is idle and powerd requested to turn off all displays. | 176 // - the device is idle and powerd requested to turn off all displays. |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
471 DisplayList::iterator iter_to_update = to_update->begin(); | 487 DisplayList::iterator iter_to_update = to_update->begin(); |
472 DisplayList::const_iterator iter = displays_.begin(); | 488 DisplayList::const_iterator iter = displays_.begin(); |
473 for (; iter != displays_.end() && iter_to_update != to_update->end(); | 489 for (; iter != displays_.end() && iter_to_update != to_update->end(); |
474 ++iter, ++iter_to_update) { | 490 ++iter, ++iter_to_update) { |
475 (*iter_to_update).set_id((*iter).id()); | 491 (*iter_to_update).set_id((*iter).id()); |
476 } | 492 } |
477 } | 493 } |
478 | 494 |
479 } // namespace internal | 495 } // namespace internal |
480 } // namespace ash | 496 } // namespace ash |
OLD | NEW |