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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 const gfx::Display& MultiDisplayManager::GetDisplayMatching( | 304 const gfx::Display& MultiDisplayManager::GetDisplayMatching( |
305 const gfx::Rect& rect) const { | 305 const gfx::Rect& rect) const { |
306 if (rect.IsEmpty()) | 306 if (rect.IsEmpty()) |
307 return GetDisplayNearestPoint(rect.origin()); | 307 return GetDisplayNearestPoint(rect.origin()); |
308 | 308 |
309 int max = 0; | 309 int max = 0; |
310 const gfx::Display* matching = 0; | 310 const gfx::Display* matching = 0; |
311 for (std::vector<gfx::Display>::const_iterator iter = displays_.begin(); | 311 for (std::vector<gfx::Display>::const_iterator iter = displays_.begin(); |
312 iter != displays_.end(); ++iter) { | 312 iter != displays_.end(); ++iter) { |
313 const gfx::Display& display = *iter; | 313 const gfx::Display& display = *iter; |
314 gfx::Rect intersect = display.bounds().Intersect(rect); | 314 gfx::Rect intersect = display.bounds(); |
| 315 intersect.Intersect(rect); |
315 int area = intersect.width() * intersect.height(); | 316 int area = intersect.width() * intersect.height(); |
316 if (area > max) { | 317 if (area > max) { |
317 max = area; | 318 max = area; |
318 matching = &(*iter); | 319 matching = &(*iter); |
319 } | 320 } |
320 } | 321 } |
321 // Fallback to the primary display if there is no matching display. | 322 // Fallback to the primary display if there is no matching display. |
322 return matching ? *matching : DisplayController::GetPrimaryDisplay(); | 323 return matching ? *matching : DisplayController::GetPrimaryDisplay(); |
323 } | 324 } |
324 | 325 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 DisplayList::iterator iter_to_update = to_update->begin(); | 453 DisplayList::iterator iter_to_update = to_update->begin(); |
453 DisplayList::const_iterator iter = displays_.begin(); | 454 DisplayList::const_iterator iter = displays_.begin(); |
454 for (; iter != displays_.end() && iter_to_update != to_update->end(); | 455 for (; iter != displays_.end() && iter_to_update != to_update->end(); |
455 ++iter, ++iter_to_update) { | 456 ++iter, ++iter_to_update) { |
456 (*iter_to_update).set_id((*iter).id()); | 457 (*iter_to_update).set_id((*iter).id()); |
457 } | 458 } |
458 } | 459 } |
459 | 460 |
460 } // namespace internal | 461 } // namespace internal |
461 } // namespace ash | 462 } // namespace ash |
OLD | NEW |