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 10 matching lines...) Expand all Loading... |
21 float target_opacity, | 21 float target_opacity, |
22 gfx::Point pivot, | 22 gfx::Point pivot, |
23 base::TimeDelta duration, | 23 base::TimeDelta duration, |
24 gfx::Tween::Type tween_type) | 24 gfx::Tween::Type tween_type) |
25 : ui::LayerAnimationElement( | 25 : ui::LayerAnimationElement( |
26 LayerAnimationElement::TRANSFORM | LayerAnimationElement::OPACITY, | 26 LayerAnimationElement::TRANSFORM | LayerAnimationElement::OPACITY, |
27 duration), | 27 duration), |
28 tween_type_(tween_type), | 28 tween_type_(tween_type), |
29 initial_opacity_(initial_opacity), | 29 initial_opacity_(initial_opacity), |
30 target_opacity_(target_opacity) { | 30 target_opacity_(target_opacity) { |
31 std::unique_ptr<ui::InterpolatedTransform> rotation( | 31 std::unique_ptr<ui::InterpolatedTransform> rotation = |
32 new ui::InterpolatedTransformAboutPivot( | 32 base::MakeUnique<ui::InterpolatedTransformAboutPivot>( |
33 pivot, new ui::InterpolatedRotation(start_degrees, end_degrees))); | 33 pivot, base::MakeUnique<ui::InterpolatedRotation>(start_degrees, |
| 34 end_degrees)); |
34 | 35 |
35 // 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. |
36 gfx::Transform current_transform = layer->GetTargetTransform(); | 37 gfx::Transform current_transform = layer->GetTargetTransform(); |
37 interpolated_transform_.reset( | 38 interpolated_transform_.reset( |
38 new ui::InterpolatedConstantTransform(current_transform)); | 39 new ui::InterpolatedConstantTransform(current_transform)); |
39 interpolated_transform_->SetChild(rotation.release()); | 40 interpolated_transform_->SetChild(std::move(rotation)); |
40 } | 41 } |
41 | 42 |
42 ScreenRotationAnimation::~ScreenRotationAnimation() {} | 43 ScreenRotationAnimation::~ScreenRotationAnimation() {} |
43 | 44 |
44 void ScreenRotationAnimation::OnStart(ui::LayerAnimationDelegate* delegate) {} | 45 void ScreenRotationAnimation::OnStart(ui::LayerAnimationDelegate* delegate) {} |
45 | 46 |
46 bool ScreenRotationAnimation::OnProgress(double current, | 47 bool ScreenRotationAnimation::OnProgress(double current, |
47 ui::LayerAnimationDelegate* delegate) { | 48 ui::LayerAnimationDelegate* delegate) { |
48 const double tweened = gfx::Tween::CalculateValue(tween_type_, current); | 49 const double tweened = gfx::Tween::CalculateValue(tween_type_, current); |
49 delegate->SetTransformFromAnimation( | 50 delegate->SetTransformFromAnimation( |
(...skipping 12 matching lines...) Expand all Loading... |
62 // deleting it. This is then passed here: http://crbug.com/661313 | 63 // deleting it. This is then passed here: http://crbug.com/661313 |
63 if (!delegate) | 64 if (!delegate) |
64 return; | 65 return; |
65 | 66 |
66 TargetValue target_value; | 67 TargetValue target_value; |
67 OnGetTarget(&target_value); | 68 OnGetTarget(&target_value); |
68 delegate->SetTransformFromAnimation(target_value.transform); | 69 delegate->SetTransformFromAnimation(target_value.transform); |
69 } | 70 } |
70 | 71 |
71 } // namespace ash | 72 } // namespace ash |
OLD | NEW |