| 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 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 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 40 if (t >= duration_.InSecondsF()) | 40 if (t >= duration_.InSecondsF()) |
| 41 return target_value_; | 41 return target_value_; |
| 42 if (t <= 0.0) | 42 if (t <= 0.0) |
| 43 return initial_value_; | 43 return initial_value_; |
| 44 double progress = t / duration_.InSecondsF(); | 44 double progress = t / duration_.InSecondsF(); |
| 45 | 45 |
| 46 gfx::DecomposedTransform to_return; | 46 gfx::DecomposedTransform to_return; |
| 47 gfx::BlendDecomposedTransforms(&to_return, | 47 gfx::BlendDecomposedTransforms(&to_return, |
| 48 decomposed_target_value_, | 48 decomposed_target_value_, |
| 49 decomposed_initial_value_, | 49 decomposed_initial_value_, |
| 50 Tween::CalculateValue(tween_type_, progress)); | 50 gfx::Tween::CalculateValue(tween_type_, |
| 51 progress)); |
| 51 return gfx::ComposeTransform(to_return); | 52 return gfx::ComposeTransform(to_return); |
| 52 } | 53 } |
| 53 | 54 |
| 54 bool TransformAnimationCurveAdapter::AnimatedBoundsForBox( | 55 bool TransformAnimationCurveAdapter::AnimatedBoundsForBox( |
| 55 const gfx::BoxF& box, | 56 const gfx::BoxF& box, |
| 56 gfx::BoxF* bounds) const { | 57 gfx::BoxF* bounds) const { |
| 57 // TODO(ajuma): Once cc::TransformOperation::BlendedBoundsForBox supports | 58 // TODO(ajuma): Once cc::TransformOperation::BlendedBoundsForBox supports |
| 58 // computing bounds for TransformOperationMatrix, use that to compute | 59 // computing bounds for TransformOperationMatrix, use that to compute |
| 59 // the bounds we need here. | 60 // the bounds we need here. |
| 60 return false; | 61 return false; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 bool InverseTransformCurveAdapter::AnimatedBoundsForBox( | 104 bool InverseTransformCurveAdapter::AnimatedBoundsForBox( |
| 104 const gfx::BoxF& box, | 105 const gfx::BoxF& box, |
| 105 gfx::BoxF* bounds) const { | 106 gfx::BoxF* bounds) const { |
| 106 // TODO(ajuma): Once cc::TransformOperation::BlendedBoundsForBox supports | 107 // TODO(ajuma): Once cc::TransformOperation::BlendedBoundsForBox supports |
| 107 // computing bounds for TransformOperationMatrix, use that to compute | 108 // computing bounds for TransformOperationMatrix, use that to compute |
| 108 // the bounds we need here. | 109 // the bounds we need here. |
| 109 return false; | 110 return false; |
| 110 } | 111 } |
| 111 | 112 |
| 112 } // namespace ui | 113 } // namespace ui |
| OLD | NEW |