| 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_animation.h" | 5 #include "ash/rotator/screen_rotation_animation.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "ui/compositor/layer.h" | 8 #include "ui/compositor/layer.h" |
| 9 #include "ui/compositor/layer_animation_delegate.h" | 9 #include "ui/compositor/layer_animation_delegate.h" |
| 10 #include "ui/gfx/animation/tween.h" | 10 #include "ui/gfx/animation/tween.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 float target_opacity, | 22 float target_opacity, |
| 23 gfx::Point pivot, | 23 gfx::Point pivot, |
| 24 base::TimeDelta duration, | 24 base::TimeDelta duration, |
| 25 gfx::Tween::Type tween_type) | 25 gfx::Tween::Type tween_type) |
| 26 : ui::LayerAnimationElement( | 26 : ui::LayerAnimationElement( |
| 27 LayerAnimationElement::TRANSFORM | LayerAnimationElement::OPACITY, | 27 LayerAnimationElement::TRANSFORM | LayerAnimationElement::OPACITY, |
| 28 duration), | 28 duration), |
| 29 tween_type_(tween_type), | 29 tween_type_(tween_type), |
| 30 initial_opacity_(initial_opacity), | 30 initial_opacity_(initial_opacity), |
| 31 target_opacity_(target_opacity) { | 31 target_opacity_(target_opacity) { |
| 32 scoped_ptr<ui::InterpolatedTransform> rotation( | 32 std::unique_ptr<ui::InterpolatedTransform> rotation( |
| 33 new ui::InterpolatedTransformAboutPivot( | 33 new ui::InterpolatedTransformAboutPivot( |
| 34 pivot, new ui::InterpolatedRotation(start_degrees, end_degrees))); | 34 pivot, new ui::InterpolatedRotation(start_degrees, end_degrees))); |
| 35 | 35 |
| 36 // Use the target transform/bounds in case the layer is already animating. | 36 // Use the target transform/bounds in case the layer is already animating. |
| 37 gfx::Transform current_transform = layer->GetTargetTransform(); | 37 gfx::Transform current_transform = layer->GetTargetTransform(); |
| 38 interpolated_transform_.reset( | 38 interpolated_transform_.reset( |
| 39 new ui::InterpolatedConstantTransform(current_transform)); | 39 new ui::InterpolatedConstantTransform(current_transform)); |
| 40 interpolated_transform_->SetChild(rotation.release()); | 40 interpolated_transform_->SetChild(rotation.release()); |
| 41 } | 41 } |
| 42 | 42 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 60 target->transform = interpolated_transform_->Interpolate(1.0); | 60 target->transform = interpolated_transform_->Interpolate(1.0); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void ScreenRotationAnimation::OnAbort(ui::LayerAnimationDelegate* delegate) { | 63 void ScreenRotationAnimation::OnAbort(ui::LayerAnimationDelegate* delegate) { |
| 64 TargetValue target_value; | 64 TargetValue target_value; |
| 65 OnGetTarget(&target_value); | 65 OnGetTarget(&target_value); |
| 66 delegate->SetTransformFromAnimation(target_value.transform); | 66 delegate->SetTransformFromAnimation(target_value.transform); |
| 67 } | 67 } |
| 68 | 68 |
| 69 } // namespace ash | 69 } // namespace ash |
| OLD | NEW |