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/layer_animation_controller.h" | 5 #include "cc/layer_animation_controller.h" |
6 | 6 |
7 #include "cc/active_animation.h" | 7 #include "cc/active_animation.h" |
8 #include "cc/keyframed_animation_curve.h" | 8 #include "cc/keyframed_animation_curve.h" |
9 #include "ui/gfx/transform.h" | 9 #include "ui/gfx/transform.h" |
10 | 10 |
11 namespace cc { | 11 namespace cc { |
12 | 12 |
13 LayerAnimationController::LayerAnimationController(LayerAnimationControllerClien
t* client) | 13 LayerAnimationController::LayerAnimationController(AnimationRegistrar::ThreadNam
e threadName) |
14 : m_forceSync(false) | 14 : m_forceSync(false) |
15 , m_client(client) | 15 , m_id(-1) |
| 16 , m_opacity(1.0) |
| 17 , m_threadName(threadName) |
16 { | 18 { |
17 } | 19 } |
18 | 20 |
19 LayerAnimationController::~LayerAnimationController() | 21 LayerAnimationController::~LayerAnimationController() |
20 { | 22 { |
| 23 AnimationRegistrar::DeactivateAnimationController(this, m_threadName); |
21 } | 24 } |
22 | 25 |
23 scoped_ptr<LayerAnimationController> LayerAnimationController::create(LayerAnima
tionControllerClient* client) | 26 scoped_refptr<LayerAnimationController> LayerAnimationController::create(Animati
onRegistrar::ThreadName threadName) |
24 { | 27 { |
25 return make_scoped_ptr(new LayerAnimationController(client)); | 28 return make_scoped_refptr(new LayerAnimationController(threadName)); |
26 } | 29 } |
27 | 30 |
28 void LayerAnimationController::pauseAnimation(int animationId, double timeOffset
) | 31 void LayerAnimationController::pauseAnimation(int animationId, double timeOffset
) |
29 { | 32 { |
30 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { | 33 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { |
31 if (m_activeAnimations[i]->id() == animationId) | 34 if (m_activeAnimations[i]->id() == animationId) |
32 m_activeAnimations[i]->setRunState(ActiveAnimation::Paused, timeOffs
et + m_activeAnimations[i]->startTime()); | 35 m_activeAnimations[i]->setRunState(ActiveAnimation::Paused, timeOffs
et + m_activeAnimations[i]->startTime()); |
33 } | 36 } |
34 } | 37 } |
35 | 38 |
36 void LayerAnimationController::removeAnimation(int animationId) | 39 void LayerAnimationController::removeAnimation(int animationId) |
37 { | 40 { |
38 for (size_t i = 0; i < m_activeAnimations.size();) { | 41 for (size_t i = 0; i < m_activeAnimations.size();) { |
39 if (m_activeAnimations[i]->id() == animationId) | 42 if (m_activeAnimations[i]->id() == animationId) |
40 m_activeAnimations.remove(i); | 43 m_activeAnimations.remove(i); |
41 else | 44 else |
42 i++; | 45 i++; |
43 } | 46 } |
| 47 updateRegistration(); |
44 } | 48 } |
45 | 49 |
46 void LayerAnimationController::removeAnimation(int animationId, ActiveAnimation:
:TargetProperty targetProperty) | 50 void LayerAnimationController::removeAnimation(int animationId, ActiveAnimation:
:TargetProperty targetProperty) |
47 { | 51 { |
48 for (size_t i = 0; i < m_activeAnimations.size();) { | 52 for (size_t i = 0; i < m_activeAnimations.size();) { |
49 if (m_activeAnimations[i]->id() == animationId && m_activeAnimations[i]-
>targetProperty() == targetProperty) | 53 if (m_activeAnimations[i]->id() == animationId && m_activeAnimations[i]-
>targetProperty() == targetProperty) |
50 m_activeAnimations.remove(i); | 54 m_activeAnimations.remove(i); |
51 else | 55 else |
52 i++; | 56 i++; |
53 } | 57 } |
| 58 updateRegistration(); |
54 } | 59 } |
55 | 60 |
56 // According to render layer backing, these are for testing only. | 61 // According to render layer backing, these are for testing only. |
57 void LayerAnimationController::suspendAnimations(double monotonicTime) | 62 void LayerAnimationController::suspendAnimations(double monotonicTime) |
58 { | 63 { |
59 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { | 64 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { |
60 if (!m_activeAnimations[i]->isFinished()) | 65 if (!m_activeAnimations[i]->isFinished()) |
61 m_activeAnimations[i]->setRunState(ActiveAnimation::Paused, monotoni
cTime); | 66 m_activeAnimations[i]->setRunState(ActiveAnimation::Paused, monotoni
cTime); |
62 } | 67 } |
63 } | 68 } |
64 | 69 |
65 // Looking at GraphicsLayerCA, this appears to be the analog to suspendAnimation
s, which is for testing. | 70 // Looking at GraphicsLayerCA, this appears to be the analog to suspendAnimation
s, which is for testing. |
66 void LayerAnimationController::resumeAnimations(double monotonicTime) | 71 void LayerAnimationController::resumeAnimations(double monotonicTime) |
67 { | 72 { |
68 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { | 73 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { |
69 if (m_activeAnimations[i]->runState() == ActiveAnimation::Paused) | 74 if (m_activeAnimations[i]->runState() == ActiveAnimation::Paused) |
70 m_activeAnimations[i]->setRunState(ActiveAnimation::Running, monoton
icTime); | 75 m_activeAnimations[i]->setRunState(ActiveAnimation::Running, monoton
icTime); |
71 } | 76 } |
72 } | 77 } |
73 | 78 |
74 // Ensures that the list of active animations on the main thread and the impl th
read | 79 // Ensures that the list of active animations on the main thread and the impl th
read |
75 // are kept in sync. | 80 // are kept in sync. |
76 void LayerAnimationController::pushAnimationUpdatesTo(LayerAnimationController*
controllerImpl) | 81 void LayerAnimationController::pushAnimationUpdatesTo(LayerAnimationController*
controllerImpl) |
77 { | 82 { |
| 83 if (!isAnimatingProperty(ActiveAnimation::Opacity)) |
| 84 controllerImpl->m_opacity = m_opacity; |
| 85 |
| 86 if (!isAnimatingProperty(ActiveAnimation::Transform)) |
| 87 controllerImpl->m_transform = m_transform; |
| 88 |
78 if (m_forceSync) { | 89 if (m_forceSync) { |
79 replaceImplThreadAnimations(controllerImpl); | 90 replaceImplThreadAnimations(controllerImpl); |
80 m_forceSync = false; | 91 m_forceSync = false; |
81 } else { | 92 } else { |
82 purgeAnimationsMarkedForDeletion(); | 93 purgeAnimationsMarkedForDeletion(); |
83 pushNewAnimationsToImplThread(controllerImpl); | 94 pushNewAnimationsToImplThread(controllerImpl); |
84 | 95 |
85 // Remove finished impl side animations only after pushing, | 96 // Remove finished impl side animations only after pushing, |
86 // and only after the animations are deleted on the main thread | 97 // and only after the animations are deleted on the main thread |
87 // this insures we will never push an animation twice. | 98 // this insures we will never push an animation twice. |
88 removeAnimationsCompletedOnMainThread(controllerImpl); | 99 removeAnimationsCompletedOnMainThread(controllerImpl); |
89 | 100 |
90 pushPropertiesToImplThread(controllerImpl); | 101 pushPropertiesToImplThread(controllerImpl); |
91 } | 102 } |
92 } | 103 } |
93 | 104 |
94 void LayerAnimationController::animate(double monotonicTime, AnimationEventsVect
or* events) | 105 void LayerAnimationController::animate(double monotonicTime, AnimationEventsVect
or* events) |
95 { | 106 { |
96 startAnimationsWaitingForNextTick(monotonicTime, events); | 107 startAnimationsWaitingForNextTick(monotonicTime, events); |
97 startAnimationsWaitingForStartTime(monotonicTime, events); | 108 startAnimationsWaitingForStartTime(monotonicTime, events); |
98 startAnimationsWaitingForTargetAvailability(monotonicTime, events); | 109 startAnimationsWaitingForTargetAvailability(monotonicTime, events); |
99 resolveConflicts(monotonicTime); | 110 resolveConflicts(monotonicTime); |
100 tickAnimations(monotonicTime); | 111 tickAnimations(monotonicTime); |
101 markAnimationsForDeletion(monotonicTime, events); | 112 markAnimationsForDeletion(monotonicTime, events); |
102 startAnimationsWaitingForTargetAvailability(monotonicTime, events); | 113 startAnimationsWaitingForTargetAvailability(monotonicTime, events); |
| 114 |
| 115 updateRegistration(); |
103 } | 116 } |
104 | 117 |
105 void LayerAnimationController::addAnimation(scoped_ptr<ActiveAnimation> animatio
n) | 118 void LayerAnimationController::addAnimation(scoped_ptr<ActiveAnimation> animatio
n) |
106 { | 119 { |
107 m_activeAnimations.append(animation.Pass()); | 120 m_activeAnimations.append(animation.Pass()); |
| 121 updateRegistration(); |
108 } | 122 } |
109 | 123 |
110 ActiveAnimation* LayerAnimationController::getActiveAnimation(int groupId, Activ
eAnimation::TargetProperty targetProperty) const | 124 ActiveAnimation* LayerAnimationController::getActiveAnimation(int groupId, Activ
eAnimation::TargetProperty targetProperty) const |
111 { | 125 { |
112 for (size_t i = 0; i < m_activeAnimations.size(); ++i) | 126 for (size_t i = 0; i < m_activeAnimations.size(); ++i) |
113 if (m_activeAnimations[i]->group() == groupId && m_activeAnimations[i]->
targetProperty() == targetProperty) | 127 if (m_activeAnimations[i]->group() == groupId && m_activeAnimations[i]->
targetProperty() == targetProperty) |
114 return m_activeAnimations[i]; | 128 return m_activeAnimations[i]; |
115 return 0; | 129 return 0; |
116 } | 130 } |
117 | 131 |
(...skipping 29 matching lines...) Expand all Loading... |
147 { | 161 { |
148 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { | 162 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { |
149 if (m_activeAnimations[i]->group() == event.groupId && m_activeAnimation
s[i]->targetProperty() == event.targetProperty && m_activeAnimations[i]->needsSy
nchronizedStartTime()) { | 163 if (m_activeAnimations[i]->group() == event.groupId && m_activeAnimation
s[i]->targetProperty() == event.targetProperty && m_activeAnimations[i]->needsSy
nchronizedStartTime()) { |
150 m_activeAnimations[i]->setNeedsSynchronizedStartTime(false); | 164 m_activeAnimations[i]->setNeedsSynchronizedStartTime(false); |
151 m_activeAnimations[i]->setStartTime(event.monotonicTime); | 165 m_activeAnimations[i]->setStartTime(event.monotonicTime); |
152 return; | 166 return; |
153 } | 167 } |
154 } | 168 } |
155 } | 169 } |
156 | 170 |
157 void LayerAnimationController::setClient(LayerAnimationControllerClient* client) | 171 void LayerAnimationController::setId(int id) |
158 { | 172 { |
159 m_client = client; | 173 m_id = id; |
| 174 } |
| 175 |
| 176 bool LayerAnimationController::setOpacity(float opacity) |
| 177 { |
| 178 if (m_opacity == opacity || isAnimatingProperty(ActiveAnimation::Opacity)) |
| 179 return false; |
| 180 m_opacity = opacity; |
| 181 return true; |
| 182 } |
| 183 |
| 184 bool LayerAnimationController::setTransform(const gfx::Transform& transform) |
| 185 { |
| 186 if (m_transform == transform || isAnimatingProperty(ActiveAnimation::Transfo
rm)) |
| 187 return false; |
| 188 m_transform = transform; |
| 189 return true; |
160 } | 190 } |
161 | 191 |
162 void LayerAnimationController::pushNewAnimationsToImplThread(LayerAnimationContr
oller* controllerImpl) const | 192 void LayerAnimationController::pushNewAnimationsToImplThread(LayerAnimationContr
oller* controllerImpl) const |
163 { | 193 { |
164 // Any new animations owned by the main thread's controller are cloned and a
dde to the impl thread's controller. | 194 // Any new animations owned by the main thread's controller are cloned and a
dde to the impl thread's controller. |
165 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { | 195 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { |
166 // If the animation is already running on the impl thread, there is no n
eed to copy it over. | 196 // If the animation is already running on the impl thread, there is no n
eed to copy it over. |
167 if (controllerImpl->getActiveAnimation(m_activeAnimations[i]->group(), m
_activeAnimations[i]->targetProperty())) | 197 if (controllerImpl->getActiveAnimation(m_activeAnimations[i]->group(), m
_activeAnimations[i]->targetProperty())) |
168 continue; | 198 continue; |
169 | 199 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 } | 237 } |
208 | 238 |
209 void LayerAnimationController::startAnimationsWaitingForNextTick(double monotoni
cTime, AnimationEventsVector* events) | 239 void LayerAnimationController::startAnimationsWaitingForNextTick(double monotoni
cTime, AnimationEventsVector* events) |
210 { | 240 { |
211 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { | 241 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { |
212 if (m_activeAnimations[i]->runState() == ActiveAnimation::WaitingForNext
Tick) { | 242 if (m_activeAnimations[i]->runState() == ActiveAnimation::WaitingForNext
Tick) { |
213 m_activeAnimations[i]->setRunState(ActiveAnimation::Running, monoton
icTime); | 243 m_activeAnimations[i]->setRunState(ActiveAnimation::Running, monoton
icTime); |
214 if (!m_activeAnimations[i]->hasSetStartTime()) | 244 if (!m_activeAnimations[i]->hasSetStartTime()) |
215 m_activeAnimations[i]->setStartTime(monotonicTime); | 245 m_activeAnimations[i]->setStartTime(monotonicTime); |
216 if (events) | 246 if (events) |
217 events->push_back(AnimationEvent(AnimationEvent::Started, m_clie
nt->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty(
), monotonicTime)); | 247 events->push_back(AnimationEvent(AnimationEvent::Started, m_id,
m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty(), monoton
icTime)); |
218 } | 248 } |
219 } | 249 } |
220 } | 250 } |
221 | 251 |
222 void LayerAnimationController::startAnimationsWaitingForStartTime(double monoton
icTime, AnimationEventsVector* events) | 252 void LayerAnimationController::startAnimationsWaitingForStartTime(double monoton
icTime, AnimationEventsVector* events) |
223 { | 253 { |
224 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { | 254 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { |
225 if (m_activeAnimations[i]->runState() == ActiveAnimation::WaitingForStar
tTime && m_activeAnimations[i]->startTime() <= monotonicTime) { | 255 if (m_activeAnimations[i]->runState() == ActiveAnimation::WaitingForStar
tTime && m_activeAnimations[i]->startTime() <= monotonicTime) { |
226 m_activeAnimations[i]->setRunState(ActiveAnimation::Running, monoton
icTime); | 256 m_activeAnimations[i]->setRunState(ActiveAnimation::Running, monoton
icTime); |
227 if (events) | 257 if (events) |
228 events->push_back(AnimationEvent(AnimationEvent::Started, m_clie
nt->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty(
), monotonicTime)); | 258 events->push_back(AnimationEvent(AnimationEvent::Started, m_id,
m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty(), monoton
icTime)); |
229 } | 259 } |
230 } | 260 } |
231 } | 261 } |
232 | 262 |
233 void LayerAnimationController::startAnimationsWaitingForTargetAvailability(doubl
e monotonicTime, AnimationEventsVector* events) | 263 void LayerAnimationController::startAnimationsWaitingForTargetAvailability(doubl
e monotonicTime, AnimationEventsVector* events) |
234 { | 264 { |
235 // First collect running properties. | 265 // First collect running properties. |
236 TargetProperties blockedProperties; | 266 TargetProperties blockedProperties; |
237 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { | 267 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { |
238 if (m_activeAnimations[i]->runState() == ActiveAnimation::Running || m_a
ctiveAnimations[i]->runState() == ActiveAnimation::Finished) | 268 if (m_activeAnimations[i]->runState() == ActiveAnimation::Running || m_a
ctiveAnimations[i]->runState() == ActiveAnimation::Finished) |
(...skipping 18 matching lines...) Expand all Loading... |
257 if (!blockedProperties.insert(*pIter).second) | 287 if (!blockedProperties.insert(*pIter).second) |
258 nullIntersection = false; | 288 nullIntersection = false; |
259 } | 289 } |
260 | 290 |
261 // If the intersection is null, then we are free to start the animat
ions in the group. | 291 // If the intersection is null, then we are free to start the animat
ions in the group. |
262 if (nullIntersection) { | 292 if (nullIntersection) { |
263 m_activeAnimations[i]->setRunState(ActiveAnimation::Running, mon
otonicTime); | 293 m_activeAnimations[i]->setRunState(ActiveAnimation::Running, mon
otonicTime); |
264 if (!m_activeAnimations[i]->hasSetStartTime()) | 294 if (!m_activeAnimations[i]->hasSetStartTime()) |
265 m_activeAnimations[i]->setStartTime(monotonicTime); | 295 m_activeAnimations[i]->setStartTime(monotonicTime); |
266 if (events) | 296 if (events) |
267 events->push_back(AnimationEvent(AnimationEvent::Started, m_
client->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetPrope
rty(), monotonicTime)); | 297 events->push_back(AnimationEvent(AnimationEvent::Started, m_
id, m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty(), mon
otonicTime)); |
268 for (size_t j = i + 1; j < m_activeAnimations.size(); ++j) { | 298 for (size_t j = i + 1; j < m_activeAnimations.size(); ++j) { |
269 if (m_activeAnimations[i]->group() == m_activeAnimations[j]-
>group()) { | 299 if (m_activeAnimations[i]->group() == m_activeAnimations[j]-
>group()) { |
270 m_activeAnimations[j]->setRunState(ActiveAnimation::Runn
ing, monotonicTime); | 300 m_activeAnimations[j]->setRunState(ActiveAnimation::Runn
ing, monotonicTime); |
271 if (!m_activeAnimations[j]->hasSetStartTime()) | 301 if (!m_activeAnimations[j]->hasSetStartTime()) |
272 m_activeAnimations[j]->setStartTime(monotonicTime); | 302 m_activeAnimations[j]->setStartTime(monotonicTime); |
273 } | 303 } |
274 } | 304 } |
275 } | 305 } |
276 } | 306 } |
277 } | 307 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 break; | 343 break; |
314 } | 344 } |
315 } | 345 } |
316 } | 346 } |
317 if (allAnimsWithSameIdAreFinished) { | 347 if (allAnimsWithSameIdAreFinished) { |
318 // We now need to remove all animations with the same group id as gr
oupId | 348 // We now need to remove all animations with the same group id as gr
oupId |
319 // (and send along animation finished notifications, if necessary). | 349 // (and send along animation finished notifications, if necessary). |
320 for (size_t j = i; j < m_activeAnimations.size(); j++) { | 350 for (size_t j = i; j < m_activeAnimations.size(); j++) { |
321 if (groupId == m_activeAnimations[j]->group()) { | 351 if (groupId == m_activeAnimations[j]->group()) { |
322 if (events) | 352 if (events) |
323 events->push_back(AnimationEvent(AnimationEvent::Finishe
d, m_client->id(), m_activeAnimations[j]->group(), m_activeAnimations[j]->target
Property(), monotonicTime)); | 353 events->push_back(AnimationEvent(AnimationEvent::Finishe
d, m_id, m_activeAnimations[j]->group(), m_activeAnimations[j]->targetProperty()
, monotonicTime)); |
324 m_activeAnimations[j]->setRunState(ActiveAnimation::WaitingF
orDeletion, monotonicTime); | 354 m_activeAnimations[j]->setRunState(ActiveAnimation::WaitingF
orDeletion, monotonicTime); |
325 } | 355 } |
326 } | 356 } |
327 } | 357 } |
328 } | 358 } |
329 } | 359 } |
330 | 360 |
331 void LayerAnimationController::purgeAnimationsMarkedForDeletion() | 361 void LayerAnimationController::purgeAnimationsMarkedForDeletion() |
332 { | 362 { |
333 for (size_t i = 0; i < m_activeAnimations.size();) { | 363 for (size_t i = 0; i < m_activeAnimations.size();) { |
(...skipping 17 matching lines...) Expand all Loading... |
351 toAdd = m_activeAnimations[i]->cloneAndInitialize(ActiveAnimation::C
ontrollingInstance, initialRunState, startTime).Pass(); | 381 toAdd = m_activeAnimations[i]->cloneAndInitialize(ActiveAnimation::C
ontrollingInstance, initialRunState, startTime).Pass(); |
352 } else | 382 } else |
353 toAdd = m_activeAnimations[i]->clone(ActiveAnimation::ControllingIns
tance).Pass(); | 383 toAdd = m_activeAnimations[i]->clone(ActiveAnimation::ControllingIns
tance).Pass(); |
354 | 384 |
355 controllerImpl->addAnimation(toAdd.Pass()); | 385 controllerImpl->addAnimation(toAdd.Pass()); |
356 } | 386 } |
357 } | 387 } |
358 | 388 |
359 void LayerAnimationController::tickAnimations(double monotonicTime) | 389 void LayerAnimationController::tickAnimations(double monotonicTime) |
360 { | 390 { |
361 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { | 391 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { |
362 if (m_activeAnimations[i]->runState() == ActiveAnimation::Running || m_a
ctiveAnimations[i]->runState() == ActiveAnimation::Paused) { | 392 if (m_activeAnimations[i]->runState() == ActiveAnimation::Running || m_a
ctiveAnimations[i]->runState() == ActiveAnimation::Paused) { |
363 double trimmed = m_activeAnimations[i]->trimTimeToCurrentIteration(m
onotonicTime); | 393 double trimmed = m_activeAnimations[i]->trimTimeToCurrentIteration(m
onotonicTime); |
364 | 394 |
365 // Animation assumes its initial value until it gets the synchronize
d start time | 395 // Animation assumes its initial value until it gets the synchronize
d start time |
366 // from the impl thread and can start ticking. | 396 // from the impl thread and can start ticking. |
367 if (m_activeAnimations[i]->needsSynchronizedStartTime()) | 397 if (m_activeAnimations[i]->needsSynchronizedStartTime()) |
368 trimmed = 0; | 398 trimmed = 0; |
369 | 399 |
370 switch (m_activeAnimations[i]->targetProperty()) { | 400 switch (m_activeAnimations[i]->targetProperty()) { |
371 | 401 |
372 case ActiveAnimation::Transform: { | 402 case ActiveAnimation::Transform: { |
373 const TransformAnimationCurve* transformAnimationCurve = m_activ
eAnimations[i]->curve()->toTransformAnimationCurve(); | 403 const TransformAnimationCurve* transformAnimationCurve = m_activ
eAnimations[i]->curve()->toTransformAnimationCurve(); |
374 const gfx::Transform matrix = transformAnimationCurve->getValue(
trimmed).toTransform(); | 404 m_transform = transformAnimationCurve->getValue(trimmed).toTrans
form(); |
375 if (m_activeAnimations[i]->isFinishedAt(monotonicTime)) | 405 if (m_activeAnimations[i]->isFinishedAt(monotonicTime)) |
376 m_activeAnimations[i]->setRunState(ActiveAnimation::Finished
, monotonicTime); | 406 m_activeAnimations[i]->setRunState(ActiveAnimation::Finished
, monotonicTime); |
377 | |
378 m_client->setTransformFromAnimation(matrix); | |
379 break; | 407 break; |
380 } | 408 } |
381 | 409 |
382 case ActiveAnimation::Opacity: { | 410 case ActiveAnimation::Opacity: { |
383 const FloatAnimationCurve* floatAnimationCurve = m_activeAnimati
ons[i]->curve()->toFloatAnimationCurve(); | 411 const FloatAnimationCurve* floatAnimationCurve = m_activeAnimati
ons[i]->curve()->toFloatAnimationCurve(); |
384 const float opacity = floatAnimationCurve->getValue(trimmed); | 412 m_opacity = floatAnimationCurve->getValue(trimmed); |
385 if (m_activeAnimations[i]->isFinishedAt(monotonicTime)) | 413 if (m_activeAnimations[i]->isFinishedAt(monotonicTime)) |
386 m_activeAnimations[i]->setRunState(ActiveAnimation::Finished
, monotonicTime); | 414 m_activeAnimations[i]->setRunState(ActiveAnimation::Finished
, monotonicTime); |
387 | |
388 m_client->setOpacityFromAnimation(opacity); | |
389 break; | 415 break; |
390 } | 416 } |
391 | 417 |
392 // Do nothing for sentinel value. | 418 // Do nothing for sentinel value. |
393 case ActiveAnimation::TargetPropertyEnumSize: | 419 case ActiveAnimation::TargetPropertyEnumSize: |
394 NOTREACHED(); | 420 NOTREACHED(); |
395 } | 421 } |
396 } | 422 } |
397 } | 423 } |
398 } | 424 } |
399 | 425 |
| 426 void LayerAnimationController::updateRegistration() |
| 427 { |
| 428 if (hasActiveAnimation()) |
| 429 AnimationRegistrar::ActivateAnimationController(this, m_threadName); |
| 430 else |
| 431 AnimationRegistrar::DeactivateAnimationController(this, m_threadName); |
| 432 } |
| 433 |
400 } // namespace cc | 434 } // namespace cc |
OLD | NEW |