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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 143 } |
144 | 144 |
145 float FakeFloatTransition::getValue(double time) const | 145 float FakeFloatTransition::getValue(double time) const |
146 { | 146 { |
147 time /= m_duration; | 147 time /= m_duration; |
148 if (time >= 1) | 148 if (time >= 1) |
149 time = 1; | 149 time = 1; |
150 return (1 - time) * m_from + time * m_to; | 150 return (1 - time) * m_from + time * m_to; |
151 } | 151 } |
152 | 152 |
| 153 FakeLayerAnimationControllerClient::FakeLayerAnimationControllerClient() |
| 154 : m_opacity(0) |
| 155 { |
| 156 } |
| 157 |
| 158 FakeLayerAnimationControllerClient::~FakeLayerAnimationControllerClient() |
| 159 { |
| 160 } |
| 161 |
| 162 int FakeLayerAnimationControllerClient::id() const |
| 163 { |
| 164 return 0; |
| 165 } |
| 166 |
| 167 void FakeLayerAnimationControllerClient::setOpacityFromAnimation(float opacity) |
| 168 { |
| 169 m_opacity = opacity; |
| 170 } |
| 171 |
| 172 float FakeLayerAnimationControllerClient::opacity() const |
| 173 { |
| 174 return m_opacity; |
| 175 } |
| 176 |
| 177 void FakeLayerAnimationControllerClient::setTransformFromAnimation(const gfx::Tr
ansform& transform) |
| 178 { |
| 179 m_transform = transform; |
| 180 } |
| 181 |
| 182 const gfx::Transform& FakeLayerAnimationControllerClient::transform() const |
| 183 { |
| 184 return m_transform; |
| 185 } |
| 186 |
153 scoped_ptr<cc::AnimationCurve> FakeFloatTransition::clone() const | 187 scoped_ptr<cc::AnimationCurve> FakeFloatTransition::clone() const |
154 { | 188 { |
155 return make_scoped_ptr(new FakeFloatTransition(*this)).PassAs<cc::AnimationC
urve>(); | 189 return make_scoped_ptr(new FakeFloatTransition(*this)).PassAs<cc::AnimationC
urve>(); |
156 } | 190 } |
157 | 191 |
158 int addOpacityTransitionToController(cc::LayerAnimationController& controller, d
ouble duration, float startOpacity, float endOpacity, bool useTimingFunction) | 192 int addOpacityTransitionToController(cc::LayerAnimationController& controller, d
ouble duration, float startOpacity, float endOpacity, bool useTimingFunction) |
159 { | 193 { |
160 return addOpacityTransition(controller, duration, startOpacity, endOpacity,
useTimingFunction); | 194 return addOpacityTransition(controller, duration, startOpacity, endOpacity,
useTimingFunction); |
161 } | 195 } |
162 | 196 |
(...skipping 16 matching lines...) Expand all Loading... |
179 { | 213 { |
180 return addAnimatedTransform(layer, duration, deltaX, deltaY); | 214 return addAnimatedTransform(layer, duration, deltaX, deltaY); |
181 } | 215 } |
182 | 216 |
183 int addAnimatedTransformToLayer(cc::LayerImpl& layer, double duration, int delta
X, int deltaY) | 217 int addAnimatedTransformToLayer(cc::LayerImpl& layer, double duration, int delta
X, int deltaY) |
184 { | 218 { |
185 return addAnimatedTransform(*layer.layerAnimationController(), duration, del
taX, deltaY); | 219 return addAnimatedTransform(*layer.layerAnimationController(), duration, del
taX, deltaY); |
186 } | 220 } |
187 | 221 |
188 } // namespace cc | 222 } // namespace cc |
OLD | NEW |