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

Side by Side Diff: cc/layer_animation_controller.cc

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

Powered by Google App Engine
This is Rietveld 408576698