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" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
14 #include "base/string_split.h" | 14 #include "base/string_split.h" |
15 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
16 #include "ui/aura/aura_switches.h" | 16 #include "ui/aura/aura_switches.h" |
17 #include "ui/aura/env.h" | 17 #include "ui/aura/env.h" |
18 #include "ui/aura/root_window.h" | 18 #include "ui/aura/root_window.h" |
19 #include "ui/aura/root_window_host.h" | 19 #include "ui/aura/root_window_host.h" |
20 #include "ui/aura/window_property.h" | 20 #include "ui/aura/window_property.h" |
21 #include "ui/gfx/display.h" | 21 #include "ui/gfx/display.h" |
22 #include "ui/gfx/screen.h" | 22 #include "ui/gfx/screen.h" |
| 23 #include "ui/gfx/point_conversions.h" |
23 #include "ui/gfx/rect.h" | 24 #include "ui/gfx/rect.h" |
| 25 #include "ui/gfx/size_conversions.h" |
24 | 26 |
25 #if defined(USE_X11) | 27 #if defined(USE_X11) |
26 #include "ui/base/x/x11_util.h" | 28 #include "ui/base/x/x11_util.h" |
27 #endif | 29 #endif |
28 | 30 |
29 #if defined(OS_CHROMEOS) | 31 #if defined(OS_CHROMEOS) |
30 #include "base/chromeos/chromeos_version.h" | 32 #include "base/chromeos/chromeos_version.h" |
31 #include "chromeos/display/output_configurator.h" | 33 #include "chromeos/display/output_configurator.h" |
32 #endif | 34 #endif |
33 | 35 |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 401 |
400 void MultiDisplayManager::ScaleDisplayImpl() { | 402 void MultiDisplayManager::ScaleDisplayImpl() { |
401 DCHECK(!displays_.empty()); | 403 DCHECK(!displays_.empty()); |
402 std::vector<gfx::Display> new_displays; | 404 std::vector<gfx::Display> new_displays; |
403 for (DisplayList::const_iterator iter = displays_.begin(); | 405 for (DisplayList::const_iterator iter = displays_.begin(); |
404 iter != displays_.end(); ++iter) { | 406 iter != displays_.end(); ++iter) { |
405 gfx::Display display = *iter; | 407 gfx::Display display = *iter; |
406 float factor = display.device_scale_factor() == 1.0f ? 2.0f : 1.0f; | 408 float factor = display.device_scale_factor() == 1.0f ? 2.0f : 1.0f; |
407 display.SetScaleAndBounds( | 409 display.SetScaleAndBounds( |
408 factor, gfx::Rect(display.bounds_in_pixel().origin(), | 410 factor, gfx::Rect(display.bounds_in_pixel().origin(), |
409 display.size().Scale(factor))); | 411 gfx::ToFlooredSize(display.size().Scale(factor)))); |
410 new_displays.push_back(display); | 412 new_displays.push_back(display); |
411 } | 413 } |
412 OnNativeDisplaysChanged(new_displays); | 414 OnNativeDisplaysChanged(new_displays); |
413 } | 415 } |
414 | 416 |
415 gfx::Display& MultiDisplayManager::FindDisplayForRootWindow( | 417 gfx::Display& MultiDisplayManager::FindDisplayForRootWindow( |
416 const aura::RootWindow* root_window) { | 418 const aura::RootWindow* root_window) { |
417 int64 id = root_window->GetProperty(kDisplayIdKey); | 419 int64 id = root_window->GetProperty(kDisplayIdKey); |
418 // if id is |kInvaildDisplayID|, it's being deleted. | 420 // if id is |kInvaildDisplayID|, it's being deleted. |
419 DCHECK(id != gfx::Display::kInvalidDisplayID); | 421 DCHECK(id != gfx::Display::kInvalidDisplayID); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 DisplayList::iterator iter_to_update = to_update->begin(); | 453 DisplayList::iterator iter_to_update = to_update->begin(); |
452 DisplayList::const_iterator iter = displays_.begin(); | 454 DisplayList::const_iterator iter = displays_.begin(); |
453 for (; iter != displays_.end() && iter_to_update != to_update->end(); | 455 for (; iter != displays_.end() && iter_to_update != to_update->end(); |
454 ++iter, ++iter_to_update) { | 456 ++iter, ++iter_to_update) { |
455 (*iter_to_update).set_id((*iter).id()); | 457 (*iter_to_update).set_id((*iter).id()); |
456 } | 458 } |
457 } | 459 } |
458 | 460 |
459 } // namespace internal | 461 } // namespace internal |
460 } // namespace ash | 462 } // namespace ash |
OLD | NEW |