| 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 | |
| 187 scoped_ptr<cc::AnimationCurve> FakeFloatTransition::clone() const | 153 scoped_ptr<cc::AnimationCurve> FakeFloatTransition::clone() const |
| 188 { | 154 { |
| 189 return make_scoped_ptr(new FakeFloatTransition(*this)).PassAs<cc::AnimationC
urve>(); | 155 return make_scoped_ptr(new FakeFloatTransition(*this)).PassAs<cc::AnimationC
urve>(); |
| 190 } | 156 } |
| 191 | 157 |
| 192 int addOpacityTransitionToController(cc::LayerAnimationController& controller, d
ouble duration, float startOpacity, float endOpacity, bool useTimingFunction) | 158 int addOpacityTransitionToController(cc::LayerAnimationController& controller, d
ouble duration, float startOpacity, float endOpacity, bool useTimingFunction) |
| 193 { | 159 { |
| 194 return addOpacityTransition(controller, duration, startOpacity, endOpacity,
useTimingFunction); | 160 return addOpacityTransition(controller, duration, startOpacity, endOpacity,
useTimingFunction); |
| 195 } | 161 } |
| 196 | 162 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 213 { | 179 { |
| 214 return addAnimatedTransform(layer, duration, deltaX, deltaY); | 180 return addAnimatedTransform(layer, duration, deltaX, deltaY); |
| 215 } | 181 } |
| 216 | 182 |
| 217 int addAnimatedTransformToLayer(cc::LayerImpl& layer, double duration, int delta
X, int deltaY) | 183 int addAnimatedTransformToLayer(cc::LayerImpl& layer, double duration, int delta
X, int deltaY) |
| 218 { | 184 { |
| 219 return addAnimatedTransform(*layer.layerAnimationController(), duration, del
taX, deltaY); | 185 return addAnimatedTransform(*layer.layerAnimationController(), duration, del
taX, deltaY); |
| 220 } | 186 } |
| 221 | 187 |
| 222 } // namespace WebKitTests | 188 } // namespace WebKitTests |
| OLD | NEW |