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" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 const gfx::Display& display) { | 55 const gfx::Display& display) { |
56 DisplayInfo info = | 56 DisplayInfo info = |
57 Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); | 57 Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); |
58 | 58 |
59 // TODO(oshima): Add animation. (crossfade+rotation, or just cross-fade) | 59 // TODO(oshima): Add animation. (crossfade+rotation, or just cross-fade) |
60 #if defined(OS_WIN) | 60 #if defined(OS_WIN) |
61 // Windows 8 bots refused to resize the host window, and | 61 // Windows 8 bots refused to resize the host window, and |
62 // updating the transform results in incorrectly resizing | 62 // updating the transform results in incorrectly resizing |
63 // the root window. Don't apply the transform unless | 63 // the root window. Don't apply the transform unless |
64 // necessary so that unit tests pass on win8 bots. | 64 // necessary so that unit tests pass on win8 bots. |
65 if (info.GetActiveRotation() == | 65 if (info.rotation() == root_window->GetProperty(kRotationPropertyKey)) |
66 root_window->GetProperty(kRotationPropertyKey)) { | |
67 return gfx::Transform(); | 66 return gfx::Transform(); |
68 } | 67 root_window->SetProperty(kRotationPropertyKey, info.rotation()); |
69 root_window->SetProperty(kRotationPropertyKey, info.GetActiveRotation()); | |
70 #endif | 68 #endif |
71 | 69 |
72 gfx::Transform rotate; | 70 gfx::Transform rotate; |
73 // The origin is (0, 0), so the translate width/height must be reduced by | 71 // The origin is (0, 0), so the translate width/height must be reduced by |
74 // 1 pixel. | 72 // 1 pixel. |
75 float one_pixel = 1.0f / display.device_scale_factor(); | 73 float one_pixel = 1.0f / display.device_scale_factor(); |
76 switch (info.GetActiveRotation()) { | 74 switch (info.rotation()) { |
77 case gfx::Display::ROTATE_0: | 75 case gfx::Display::ROTATE_0: |
78 break; | 76 break; |
79 case gfx::Display::ROTATE_90: | 77 case gfx::Display::ROTATE_90: |
80 rotate.Translate(display.bounds().height() - one_pixel, 0); | 78 rotate.Translate(display.bounds().height() - one_pixel, 0); |
81 rotate.Rotate(90); | 79 rotate.Rotate(90); |
82 break; | 80 break; |
83 case gfx::Display::ROTATE_270: | 81 case gfx::Display::ROTATE_270: |
84 rotate.Translate(0, display.bounds().width() - one_pixel); | 82 rotate.Translate(0, display.bounds().width() - one_pixel); |
85 rotate.Rotate(270); | 83 rotate.Rotate(270); |
86 break; | 84 break; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 } | 282 } |
285 | 283 |
286 RootWindowTransformer* CreateRootWindowTransformerForMirroredDisplay( | 284 RootWindowTransformer* CreateRootWindowTransformerForMirroredDisplay( |
287 const DisplayInfo& source_display_info, | 285 const DisplayInfo& source_display_info, |
288 const DisplayInfo& mirror_display_info) { | 286 const DisplayInfo& mirror_display_info) { |
289 return new MirrorRootWindowTransformer(source_display_info, | 287 return new MirrorRootWindowTransformer(source_display_info, |
290 mirror_display_info); | 288 mirror_display_info); |
291 } | 289 } |
292 | 290 |
293 } // namespace ash | 291 } // namespace ash |
OLD | NEW |