| Index: ui/compositor/transform_animation_curve_adapter.cc
|
| diff --git a/ui/compositor/transform_animation_curve_adapter.cc b/ui/compositor/transform_animation_curve_adapter.cc
|
| index 4b493bc7a3c6bcaed6746d1b2c9a9cfbbb15cc77..2fa941eb6c79861e1f20ff4d79c2af5ae59acc27 100644
|
| --- a/ui/compositor/transform_animation_curve_adapter.cc
|
| +++ b/ui/compositor/transform_animation_curve_adapter.cc
|
| @@ -60,4 +60,53 @@ bool TransformAnimationCurveAdapter::AnimatedBoundsForBox(
|
| return false;
|
| }
|
|
|
| +InverseTransformCurveAdapter::InverseTransformCurveAdapter(
|
| + TransformAnimationCurveAdapter base_curve,
|
| + gfx::Transform initial_value,
|
| + base::TimeDelta duration)
|
| + : base_curve_(base_curve),
|
| + initial_value_(initial_value),
|
| + duration_(duration) {
|
| + effective_initial_value_ = base_curve_.GetValue(0.0) * initial_value_;
|
| +}
|
| +
|
| +InverseTransformCurveAdapter::~InverseTransformCurveAdapter() {
|
| +}
|
| +
|
| +double InverseTransformCurveAdapter::Duration() const {
|
| + return duration_.InSeconds();
|
| +}
|
| +
|
| +scoped_ptr<cc::AnimationCurve> InverseTransformCurveAdapter::Clone() const {
|
| + scoped_ptr<InverseTransformCurveAdapter> to_return(
|
| + new InverseTransformCurveAdapter(base_curve_,
|
| + initial_value_,
|
| + duration_));
|
| + return to_return.PassAs<cc::AnimationCurve>();
|
| +}
|
| +
|
| +gfx::Transform InverseTransformCurveAdapter::GetValue(
|
| + double t) const {
|
| + if (t <= 0.0)
|
| + return initial_value_;
|
| +
|
| + gfx::Transform base_transform = base_curve_.GetValue(t);
|
| + // Invert base
|
| + gfx::Transform to_return(gfx::Transform::kSkipInitialization);
|
| + bool is_invertible = base_transform.GetInverse(&to_return);
|
| + DCHECK(is_invertible);
|
| +
|
| + to_return.PreconcatTransform(effective_initial_value_);
|
| + return to_return;
|
| +}
|
| +
|
| +bool InverseTransformCurveAdapter::AnimatedBoundsForBox(
|
| + const gfx::BoxF& box,
|
| + gfx::BoxF* bounds) const {
|
| + // TODO(ajuma): Once cc::TransformOperation::BlendedBoundsForBox supports
|
| + // computing bounds for TransformOperationMatrix, use that to compute
|
| + // the bounds we need here.
|
| + return false;
|
| +}
|
| +
|
| } // namespace ui
|
|
|