OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/test/animation_test_common.h" | 5 #include "cc/test/animation_test_common.h" |
6 | 6 |
7 #include "cc/keyframed_animation_curve.h" | 7 #include "cc/keyframed_animation_curve.h" |
8 #include "cc/layer.h" | 8 #include "cc/layer.h" |
9 #include "cc/layer_animation_controller.h" | 9 #include "cc/layer_animation_controller.h" |
10 #include "cc/layer_impl.h" | 10 #include "cc/layer_impl.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 } | 139 } |
140 | 140 |
141 float FakeFloatTransition::getValue(double time) const | 141 float FakeFloatTransition::getValue(double time) const |
142 { | 142 { |
143 time /= m_duration; | 143 time /= m_duration; |
144 if (time >= 1) | 144 if (time >= 1) |
145 time = 1; | 145 time = 1; |
146 return (1 - time) * m_from + time * m_to; | 146 return (1 - time) * m_from + time * m_to; |
147 } | 147 } |
148 | 148 |
149 FakeLayerAnimationControllerClient::FakeLayerAnimationControllerClient() | 149 FakeLayerAnimationValueObserver::FakeLayerAnimationValueObserver() |
150 : m_opacity(0) | 150 : m_opacity(0) |
151 { | 151 { |
152 } | 152 } |
153 | 153 |
154 FakeLayerAnimationControllerClient::~FakeLayerAnimationControllerClient() | 154 FakeLayerAnimationValueObserver::~FakeLayerAnimationValueObserver() |
155 { | 155 { |
156 } | 156 } |
157 | 157 |
158 int FakeLayerAnimationControllerClient::id() const | 158 void FakeLayerAnimationValueObserver::OnOpacityAnimated(float opacity) |
159 { | |
160 return 0; | |
161 } | |
162 | |
163 void FakeLayerAnimationControllerClient::setOpacityFromAnimation(float opacity) | |
164 { | 159 { |
165 m_opacity = opacity; | 160 m_opacity = opacity; |
166 } | 161 } |
167 | 162 |
168 float FakeLayerAnimationControllerClient::opacity() const | 163 void FakeLayerAnimationValueObserver::OnTransformAnimated(const gfx::Transform&
transform) |
169 { | |
170 return m_opacity; | |
171 } | |
172 | |
173 void FakeLayerAnimationControllerClient::setTransformFromAnimation(const gfx::Tr
ansform& transform) | |
174 { | 164 { |
175 m_transform = transform; | 165 m_transform = transform; |
176 } | 166 } |
177 | 167 |
178 const gfx::Transform& FakeLayerAnimationControllerClient::transform() const | |
179 { | |
180 return m_transform; | |
181 } | |
182 | |
183 scoped_ptr<cc::AnimationCurve> FakeFloatTransition::clone() const | 168 scoped_ptr<cc::AnimationCurve> FakeFloatTransition::clone() const |
184 { | 169 { |
185 return make_scoped_ptr(new FakeFloatTransition(*this)).PassAs<cc::AnimationC
urve>(); | 170 return make_scoped_ptr(new FakeFloatTransition(*this)).PassAs<cc::AnimationC
urve>(); |
186 } | 171 } |
187 | 172 |
188 int addOpacityTransitionToController(cc::LayerAnimationController& controller, d
ouble duration, float startOpacity, float endOpacity, bool useTimingFunction) | 173 int addOpacityTransitionToController(cc::LayerAnimationController& controller, d
ouble duration, float startOpacity, float endOpacity, bool useTimingFunction) |
189 { | 174 { |
190 return addOpacityTransition(controller, duration, startOpacity, endOpacity,
useTimingFunction); | 175 return addOpacityTransition(controller, duration, startOpacity, endOpacity,
useTimingFunction); |
191 } | 176 } |
192 | 177 |
(...skipping 16 matching lines...) Expand all Loading... |
209 { | 194 { |
210 return addAnimatedTransform(layer, duration, deltaX, deltaY); | 195 return addAnimatedTransform(layer, duration, deltaX, deltaY); |
211 } | 196 } |
212 | 197 |
213 int addAnimatedTransformToLayer(cc::LayerImpl& layer, double duration, int delta
X, int deltaY) | 198 int addAnimatedTransformToLayer(cc::LayerImpl& layer, double duration, int delta
X, int deltaY) |
214 { | 199 { |
215 return addAnimatedTransform(*layer.layerAnimationController(), duration, del
taX, deltaY); | 200 return addAnimatedTransform(*layer.layerAnimationController(), duration, del
taX, deltaY); |
216 } | 201 } |
217 | 202 |
218 } // namespace cc | 203 } // namespace cc |
OLD | NEW |