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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 OnNativeDisplaysChanged(new_displays); | 442 OnNativeDisplaysChanged(new_displays); |
443 } | 443 } |
444 | 444 |
445 void MultiDisplayManager::ScaleDisplayImpl() { | 445 void MultiDisplayManager::ScaleDisplayImpl() { |
446 DCHECK(!displays_.empty()); | 446 DCHECK(!displays_.empty()); |
447 std::vector<gfx::Display> new_displays; | 447 std::vector<gfx::Display> new_displays; |
448 for (DisplayList::const_iterator iter = displays_.begin(); | 448 for (DisplayList::const_iterator iter = displays_.begin(); |
449 iter != displays_.end(); ++iter) { | 449 iter != displays_.end(); ++iter) { |
450 gfx::Display display = *iter; | 450 gfx::Display display = *iter; |
451 float factor = display.device_scale_factor() == 1.0f ? 2.0f : 1.0f; | 451 float factor = display.device_scale_factor() == 1.0f ? 2.0f : 1.0f; |
452 display.SetScaleAndBounds( | 452 gfx::Point display_origin = display.bounds_in_pixel().origin(); |
453 factor, gfx::Rect(display.bounds_in_pixel().origin(), | 453 gfx::Size display_size = gfx::ToFlooredSize( |
454 gfx::ToFlooredSize(display.size().Scale(factor)))); | 454 gfx::ScaleSize(display.size(), factor)); |
| 455 display.SetScaleAndBounds(factor, gfx::Rect(display_origin, display_size)); |
455 new_displays.push_back(display); | 456 new_displays.push_back(display); |
456 } | 457 } |
457 OnNativeDisplaysChanged(new_displays); | 458 OnNativeDisplaysChanged(new_displays); |
458 } | 459 } |
459 | 460 |
460 gfx::Display& MultiDisplayManager::FindDisplayForRootWindow( | 461 gfx::Display& MultiDisplayManager::FindDisplayForRootWindow( |
461 const aura::RootWindow* root_window) { | 462 const aura::RootWindow* root_window) { |
462 int64 id = root_window->GetProperty(kDisplayIdKey); | 463 int64 id = root_window->GetProperty(kDisplayIdKey); |
463 // if id is |kInvaildDisplayID|, it's being deleted. | 464 // if id is |kInvaildDisplayID|, it's being deleted. |
464 DCHECK(id != gfx::Display::kInvalidDisplayID); | 465 DCHECK(id != gfx::Display::kInvalidDisplayID); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 DisplayList::iterator iter_to_update = to_update->begin(); | 568 DisplayList::iterator iter_to_update = to_update->begin(); |
568 DisplayList::const_iterator iter = displays_.begin(); | 569 DisplayList::const_iterator iter = displays_.begin(); |
569 for (; iter != displays_.end() && iter_to_update != to_update->end(); | 570 for (; iter != displays_.end() && iter_to_update != to_update->end(); |
570 ++iter, ++iter_to_update) { | 571 ++iter, ++iter_to_update) { |
571 (*iter_to_update).set_id((*iter).id()); | 572 (*iter_to_update).set_id((*iter).id()); |
572 } | 573 } |
573 } | 574 } |
574 | 575 |
575 } // namespace internal | 576 } // namespace internal |
576 } // namespace ash | 577 } // namespace ash |
OLD | NEW |