| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/rotator/screen_rotation_animator.h" | 5 #include "ash/rotator/screen_rotation_animator.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/display/window_tree_host_manager.h" | 8 #include "ash/display/window_tree_host_manager.h" |
| 9 #include "ash/public/cpp/shell_window_ids.h" | 9 #include "ash/public/cpp/shell_window_ids.h" |
| 10 #include "ash/rotator/screen_rotation_animation.h" | 10 #include "ash/rotator/screen_rotation_animation.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 CreateOldLayerTreeForSlowAnimation(); | 218 CreateOldLayerTreeForSlowAnimation(); |
| 219 SetRotation(rotation_request->old_rotation, rotation_request->new_rotation, | 219 SetRotation(rotation_request->old_rotation, rotation_request->new_rotation, |
| 220 rotation_request->source); | 220 rotation_request->source); |
| 221 AnimateRotation(std::move(rotation_request)); | 221 AnimateRotation(std::move(rotation_request)); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void ScreenRotationAnimator::SetRotation( | 224 void ScreenRotationAnimator::SetRotation( |
| 225 display::Display::Rotation old_rotation, | 225 display::Display::Rotation old_rotation, |
| 226 display::Display::Rotation new_rotation, | 226 display::Display::Rotation new_rotation, |
| 227 display::Display::RotationSource source) { | 227 display::Display::RotationSource source) { |
| 228 // Allow compositor locks to extend timeout, so that screen rotation only |
| 229 // takes output copy after contents are properlly resized, such as wallpaper |
| 230 // and ARC apps. |
| 231 ui::Compositor* compositor = root_window_->layer()->GetCompositor(); |
| 232 compositor->set_allow_locks_to_extend_timeout(true); |
| 228 Shell::Get()->display_manager()->SetDisplayRotation(display_id_, new_rotation, | 233 Shell::Get()->display_manager()->SetDisplayRotation(display_id_, new_rotation, |
| 229 source); | 234 source); |
| 235 compositor->set_allow_locks_to_extend_timeout(false); |
| 230 const display::Display display = | 236 const display::Display display = |
| 231 Shell::Get()->display_manager()->GetDisplayForId(display_id_); | 237 Shell::Get()->display_manager()->GetDisplayForId(display_id_); |
| 232 old_layer_tree_owner_->root()->SetTransform( | 238 old_layer_tree_owner_->root()->SetTransform( |
| 233 CreateScreenRotationOldLayerTransformForDisplay(old_rotation, | 239 CreateScreenRotationOldLayerTransformForDisplay(old_rotation, |
| 234 new_rotation, display)); | 240 new_rotation, display)); |
| 235 } | 241 } |
| 236 | 242 |
| 237 void ScreenRotationAnimator::RequestCopyScreenRotationContainerLayer( | 243 void ScreenRotationAnimator::RequestCopyScreenRotationContainerLayer( |
| 238 std::unique_ptr<cc::CopyOutputRequest> copy_output_request) { | 244 std::unique_ptr<cc::CopyOutputRequest> copy_output_request) { |
| 239 copy_output_request->set_area( | 245 copy_output_request->set_area( |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 // the rotation request comes before the copy request finished. | 490 // the rotation request comes before the copy request finished. |
| 485 if (old_layer_tree_owner_) | 491 if (old_layer_tree_owner_) |
| 486 old_layer_tree_owner_->root()->GetAnimator()->StopAnimating(); | 492 old_layer_tree_owner_->root()->GetAnimator()->StopAnimating(); |
| 487 if (new_layer_tree_owner_) | 493 if (new_layer_tree_owner_) |
| 488 new_layer_tree_owner_->root()->GetAnimator()->StopAnimating(); | 494 new_layer_tree_owner_->root()->GetAnimator()->StopAnimating(); |
| 489 if (IsDisplayIdValid(display_id_) && black_mask_layer_owner_) | 495 if (IsDisplayIdValid(display_id_) && black_mask_layer_owner_) |
| 490 root_window_->layer()->Remove(black_mask_layer_owner_->layer()); | 496 root_window_->layer()->Remove(black_mask_layer_owner_->layer()); |
| 491 } | 497 } |
| 492 | 498 |
| 493 } // namespace ash | 499 } // namespace ash |
| OLD | NEW |