| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/root_window_transformers.h" | 5 #include "ash/display/root_window_transformers.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/display/display_info.h" | 10 #include "ash/display/display_info.h" |
| 11 #include "ash/display/display_manager.h" | 11 #include "ash/display/display_manager.h" |
| 12 #include "ash/host/root_window_transformer.h" | 12 #include "ash/host/root_window_transformer.h" |
| 13 #include "ash/magnifier/magnification_controller.h" | 13 #include "ash/magnifier/magnification_controller.h" |
| 14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "third_party/skia/include/utils/SkMatrix44.h" | 17 #include "third_party/skia/include/utils/SkMatrix44.h" |
| 18 #include "ui/aura/window_event_dispatcher.h" | 18 #include "ui/aura/window_event_dispatcher.h" |
| 19 #include "ui/aura/window_property.h" | 19 #include "ui/aura/window_property.h" |
| 20 #include "ui/compositor/dip_util.h" | 20 #include "ui/compositor/dip_util.h" |
| 21 #include "ui/gfx/display.h" | 21 #include "ui/gfx/display.h" |
| 22 #include "ui/gfx/geometry/insets.h" | 22 #include "ui/gfx/geometry/insets.h" |
| 23 #include "ui/gfx/geometry/size_conversions.h" | 23 #include "ui/gfx/geometry/size_conversions.h" |
| 24 #include "ui/gfx/screen.h" |
| 24 #include "ui/gfx/transform.h" | 25 #include "ui/gfx/transform.h" |
| 25 #include "ui/gfx/transform.h" | 26 #include "ui/gfx/transform.h" |
| 26 | 27 |
| 27 DECLARE_WINDOW_PROPERTY_TYPE(gfx::Display::Rotation); | 28 DECLARE_WINDOW_PROPERTY_TYPE(gfx::Display::Rotation); |
| 28 | 29 |
| 29 namespace ash { | 30 namespace ash { |
| 30 namespace { | 31 namespace { |
| 31 | 32 |
| 32 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
| 33 DEFINE_WINDOW_PROPERTY_KEY(gfx::Display::Rotation, kRotationPropertyKey, | 34 DEFINE_WINDOW_PROPERTY_KEY(gfx::Display::Rotation, kRotationPropertyKey, |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 gfx::Insets insets_; | 273 gfx::Insets insets_; |
| 273 | 274 |
| 274 DISALLOW_COPY_AND_ASSIGN(MirrorRootWindowTransformer); | 275 DISALLOW_COPY_AND_ASSIGN(MirrorRootWindowTransformer); |
| 275 }; | 276 }; |
| 276 | 277 |
| 277 class PartialBoundsRootWindowTransformer : public RootWindowTransformer { | 278 class PartialBoundsRootWindowTransformer : public RootWindowTransformer { |
| 278 public: | 279 public: |
| 279 PartialBoundsRootWindowTransformer(const gfx::Rect& screen_bounds, | 280 PartialBoundsRootWindowTransformer(const gfx::Rect& screen_bounds, |
| 280 const gfx::Display& display) { | 281 const gfx::Display& display) { |
| 281 gfx::Display unified_display = | 282 gfx::Display unified_display = |
| 282 Shell::GetInstance()->GetScreen()->GetPrimaryDisplay(); | 283 gfx::Screen::GetScreen()->GetPrimaryDisplay(); |
| 283 DisplayInfo display_info = | 284 DisplayInfo display_info = |
| 284 Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); | 285 Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); |
| 285 root_bounds_ = gfx::Rect(display_info.bounds_in_native().size()); | 286 root_bounds_ = gfx::Rect(display_info.bounds_in_native().size()); |
| 286 float scale = root_bounds_.height() / | 287 float scale = root_bounds_.height() / |
| 287 static_cast<float>(screen_bounds.height()) / | 288 static_cast<float>(screen_bounds.height()) / |
| 288 unified_display.device_scale_factor(); | 289 unified_display.device_scale_factor(); |
| 289 transform_.Scale(scale, scale); | 290 transform_.Scale(scale, scale); |
| 290 transform_.Translate(-SkIntToMScalar(display.bounds().x()), | 291 transform_.Translate(-SkIntToMScalar(display.bounds().x()), |
| 291 -SkIntToMScalar(display.bounds().y())); | 292 -SkIntToMScalar(display.bounds().y())); |
| 292 } | 293 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 mirror_display_info); | 326 mirror_display_info); |
| 326 } | 327 } |
| 327 | 328 |
| 328 RootWindowTransformer* CreateRootWindowTransformerForUnifiedDesktop( | 329 RootWindowTransformer* CreateRootWindowTransformerForUnifiedDesktop( |
| 329 const gfx::Rect& screen_bounds, | 330 const gfx::Rect& screen_bounds, |
| 330 const gfx::Display& display) { | 331 const gfx::Display& display) { |
| 331 return new PartialBoundsRootWindowTransformer(screen_bounds, display); | 332 return new PartialBoundsRootWindowTransformer(screen_bounds, display); |
| 332 } | 333 } |
| 333 | 334 |
| 334 } // namespace ash | 335 } // namespace ash |
| OLD | NEW |