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.rotation() == root_window->GetProperty(kRotationPropertyKey)) | 65 if (info.Rotation() == root_window->GetProperty(kRotationPropertyKey)) |
66 return gfx::Transform(); | 66 return gfx::Transform(); |
67 root_window->SetProperty(kRotationPropertyKey, info.rotation()); | 67 root_window->SetProperty(kRotationPropertyKey, info.Rotation()); |
68 #endif | 68 #endif |
69 | 69 |
70 gfx::Transform rotate; | 70 gfx::Transform rotate; |
71 // 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 |
72 // 1 pixel. | 72 // 1 pixel. |
73 float one_pixel = 1.0f / display.device_scale_factor(); | 73 float one_pixel = 1.0f / display.device_scale_factor(); |
74 switch (info.rotation()) { | 74 switch (info.Rotation(gfx::Display::ROTATION_SOURCE_ACTIVE)) { |
75 case gfx::Display::ROTATE_0: | 75 case gfx::Display::ROTATE_0: |
76 break; | 76 break; |
77 case gfx::Display::ROTATE_90: | 77 case gfx::Display::ROTATE_90: |
78 rotate.Translate(display.bounds().height() - one_pixel, 0); | 78 rotate.Translate(display.bounds().height() - one_pixel, 0); |
79 rotate.Rotate(90); | 79 rotate.Rotate(90); |
80 break; | 80 break; |
81 case gfx::Display::ROTATE_270: | 81 case gfx::Display::ROTATE_270: |
82 rotate.Translate(0, display.bounds().width() - one_pixel); | 82 rotate.Translate(0, display.bounds().width() - one_pixel); |
83 rotate.Rotate(270); | 83 rotate.Rotate(270); |
84 break; | 84 break; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 } | 282 } |
283 | 283 |
284 RootWindowTransformer* CreateRootWindowTransformerForMirroredDisplay( | 284 RootWindowTransformer* CreateRootWindowTransformerForMirroredDisplay( |
285 const DisplayInfo& source_display_info, | 285 const DisplayInfo& source_display_info, |
286 const DisplayInfo& mirror_display_info) { | 286 const DisplayInfo& mirror_display_info) { |
287 return new MirrorRootWindowTransformer(source_display_info, | 287 return new MirrorRootWindowTransformer(source_display_info, |
288 mirror_display_info); | 288 mirror_display_info); |
289 } | 289 } |
290 | 290 |
291 } // namespace ash | 291 } // namespace ash |
OLD | NEW |