OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/compositor/transform_animation_curve_adapter.h" | 5 #include "ui/compositor/transform_animation_curve_adapter.h" |
6 | 6 |
7 namespace ui { | 7 namespace ui { |
8 | 8 |
9 TransformAnimationCurveAdapter::TransformAnimationCurveAdapter( | 9 TransformAnimationCurveAdapter::TransformAnimationCurveAdapter( |
10 gfx::Tween::Type tween_type, | 10 gfx::Tween::Type tween_type, |
11 gfx::Transform initial_value, | 11 gfx::Transform initial_value, |
12 gfx::Transform target_value, | 12 gfx::Transform target_value, |
13 base::TimeDelta duration) | 13 base::TimeDelta duration) |
14 : tween_type_(tween_type), | 14 : tween_type_(tween_type), |
15 initial_value_(initial_value), | 15 initial_value_(initial_value), |
16 target_value_(target_value), | 16 target_value_(target_value), |
17 duration_(duration) { | 17 duration_(duration) { |
18 gfx::DecomposeTransform(&decomposed_initial_value_, initial_value_); | 18 gfx::DecomposeTransform(&decomposed_initial_value_, initial_value_); |
19 gfx::DecomposeTransform(&decomposed_target_value_, target_value_); | 19 gfx::DecomposeTransform(&decomposed_target_value_, target_value_); |
20 } | 20 } |
21 | 21 |
22 TransformAnimationCurveAdapter::~TransformAnimationCurveAdapter() { | 22 TransformAnimationCurveAdapter::~TransformAnimationCurveAdapter() { |
23 } | 23 } |
24 | 24 |
25 double TransformAnimationCurveAdapter::Duration() const { | 25 base::TimeDelta TransformAnimationCurveAdapter::Duration() const { |
26 return duration_.InSecondsF(); | 26 return duration_; |
27 } | 27 } |
28 | 28 |
29 scoped_ptr<cc::AnimationCurve> TransformAnimationCurveAdapter::Clone() const { | 29 scoped_ptr<cc::AnimationCurve> TransformAnimationCurveAdapter::Clone() const { |
30 return make_scoped_ptr(new TransformAnimationCurveAdapter( | 30 return make_scoped_ptr(new TransformAnimationCurveAdapter( |
31 tween_type_, initial_value_, target_value_, duration_)); | 31 tween_type_, initial_value_, target_value_, duration_)); |
32 } | 32 } |
33 | 33 |
34 gfx::Transform TransformAnimationCurveAdapter::GetValue( | 34 gfx::Transform TransformAnimationCurveAdapter::GetValue( |
35 double t) const { | 35 double t) const { |
36 if (t >= duration_.InSecondsF()) | 36 if (t >= duration_.InSecondsF()) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 base::TimeDelta duration) | 79 base::TimeDelta duration) |
80 : base_curve_(base_curve), | 80 : base_curve_(base_curve), |
81 initial_value_(initial_value), | 81 initial_value_(initial_value), |
82 duration_(duration) { | 82 duration_(duration) { |
83 effective_initial_value_ = base_curve_.GetValue(0.0) * initial_value_; | 83 effective_initial_value_ = base_curve_.GetValue(0.0) * initial_value_; |
84 } | 84 } |
85 | 85 |
86 InverseTransformCurveAdapter::~InverseTransformCurveAdapter() { | 86 InverseTransformCurveAdapter::~InverseTransformCurveAdapter() { |
87 } | 87 } |
88 | 88 |
89 double InverseTransformCurveAdapter::Duration() const { | 89 base::TimeDelta InverseTransformCurveAdapter::Duration() const { |
90 return duration_.InSeconds(); | 90 return duration_; |
91 } | 91 } |
92 | 92 |
93 scoped_ptr<cc::AnimationCurve> InverseTransformCurveAdapter::Clone() const { | 93 scoped_ptr<cc::AnimationCurve> InverseTransformCurveAdapter::Clone() const { |
94 return make_scoped_ptr( | 94 return make_scoped_ptr( |
95 new InverseTransformCurveAdapter(base_curve_, initial_value_, duration_)); | 95 new InverseTransformCurveAdapter(base_curve_, initial_value_, duration_)); |
96 } | 96 } |
97 | 97 |
98 gfx::Transform InverseTransformCurveAdapter::GetValue( | 98 gfx::Transform InverseTransformCurveAdapter::GetValue( |
99 double t) const { | 99 double t) const { |
100 if (t <= 0.0) | 100 if (t <= 0.0) |
(...skipping 27 matching lines...) Expand all Loading... |
128 return initial_value_.IsIdentityOrTranslation() && | 128 return initial_value_.IsIdentityOrTranslation() && |
129 base_curve_.IsTranslation(); | 129 base_curve_.IsTranslation(); |
130 } | 130 } |
131 | 131 |
132 bool InverseTransformCurveAdapter::MaximumTargetScale(bool forward_direction, | 132 bool InverseTransformCurveAdapter::MaximumTargetScale(bool forward_direction, |
133 float* max_scale) const { | 133 float* max_scale) const { |
134 return false; | 134 return false; |
135 } | 135 } |
136 | 136 |
137 } // namespace ui | 137 } // namespace ui |
OLD | NEW |