Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: ui/compositor/transform_animation_curve_adapter.cc

Issue 22861008: Add support for inverse transform animations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add more detailed error messages in matrix comparison. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 Tween::Type tween_type,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 bool TransformAnimationCurveAdapter::AnimatedBoundsForBox( 54 bool TransformAnimationCurveAdapter::AnimatedBoundsForBox(
55 const gfx::BoxF& box, 55 const gfx::BoxF& box,
56 gfx::BoxF* bounds) const { 56 gfx::BoxF* bounds) const {
57 // TODO(ajuma): Once cc::TransformOperation::BlendedBoundsForBox supports 57 // TODO(ajuma): Once cc::TransformOperation::BlendedBoundsForBox supports
58 // computing bounds for TransformOperationMatrix, use that to compute 58 // computing bounds for TransformOperationMatrix, use that to compute
59 // the bounds we need here. 59 // the bounds we need here.
60 return false; 60 return false;
61 } 61 }
62 62
63 InverseTransformCurveAdapter::InverseTransformCurveAdapter(
64 TransformAnimationCurveAdapter base_curve,
65 gfx::Transform initial_value,
66 base::TimeDelta duration)
67 : base_curve_(base_curve),
68 initial_value_(initial_value),
69 duration_(duration) {
70 effective_initial_value_ = base_curve_.GetValue(0.0) * initial_value_;
71 }
72
73 InverseTransformCurveAdapter::~InverseTransformCurveAdapter() {
74 }
75
76 double InverseTransformCurveAdapter::Duration() const {
77 return duration_.InSeconds();
78 }
79
80 scoped_ptr<cc::AnimationCurve> InverseTransformCurveAdapter::Clone() const {
81 scoped_ptr<InverseTransformCurveAdapter> to_return(
82 new InverseTransformCurveAdapter(base_curve_,
83 initial_value_,
84 duration_));
85 return to_return.PassAs<cc::AnimationCurve>();
86 }
87
88 gfx::Transform InverseTransformCurveAdapter::GetValue(
89 double t) const {
90 if (t <= 0.0)
91 return initial_value_;
92
93 gfx::Transform base_transform = base_curve_.GetValue(t);
94 // Invert base
95 gfx::Transform to_return(gfx::Transform::kSkipInitialization);
96 DCHECK(base_transform.GetInverse(&to_return));
danakj 2013/08/30 03:03:40 DCHECKs don't run on release bots. I think you wan
avallee 2013/09/04 15:04:41 Done. D'oh!
97
98 to_return.PreconcatTransform(effective_initial_value_);
99 return to_return;
100 }
101
102 bool InverseTransformCurveAdapter::AnimatedBoundsForBox(
103 const gfx::BoxF& box,
104 gfx::BoxF* bounds) const {
105 // TODO(ajuma): Once cc::TransformOperation::BlendedBoundsForBox supports
106 // computing bounds for TransformOperationMatrix, use that to compute
107 // the bounds we need here.
108 return false;
109 }
110
63 } // namespace ui 111 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698