| 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/animation_registrar.h" | 8 #include "cc/animation_registrar.h" | 
| 9 #include "cc/keyframed_animation_curve.h" | 9 #include "cc/keyframed_animation_curve.h" | 
| 10 #include "cc/layer_animation_value_observer.h" | 10 #include "cc/layer_animation_value_observer.h" | 
| 11 #include "ui/gfx/transform.h" | 11 #include "ui/gfx/transform.h" | 
| 12 | 12 | 
|  | 13 namespace { | 
|  | 14 gfx::Transform convertWebTransformationMatrixToTransform(const WebKit::WebTransf
     ormationMatrix& matrix) | 
|  | 15 { | 
|  | 16     gfx::Transform transform; | 
|  | 17     transform.matrix().setDouble(0, 0, matrix.m11()); | 
|  | 18     transform.matrix().setDouble(0, 1, matrix.m21()); | 
|  | 19     transform.matrix().setDouble(0, 2, matrix.m31()); | 
|  | 20     transform.matrix().setDouble(0, 3, matrix.m41()); | 
|  | 21     transform.matrix().setDouble(1, 0, matrix.m12()); | 
|  | 22     transform.matrix().setDouble(1, 1, matrix.m22()); | 
|  | 23     transform.matrix().setDouble(1, 2, matrix.m32()); | 
|  | 24     transform.matrix().setDouble(1, 3, matrix.m42()); | 
|  | 25     transform.matrix().setDouble(2, 0, matrix.m13()); | 
|  | 26     transform.matrix().setDouble(2, 1, matrix.m23()); | 
|  | 27     transform.matrix().setDouble(2, 2, matrix.m33()); | 
|  | 28     transform.matrix().setDouble(2, 3, matrix.m43()); | 
|  | 29     transform.matrix().setDouble(3, 0, matrix.m14()); | 
|  | 30     transform.matrix().setDouble(3, 1, matrix.m24()); | 
|  | 31     transform.matrix().setDouble(3, 2, matrix.m34()); | 
|  | 32     transform.matrix().setDouble(3, 3, matrix.m44()); | 
|  | 33     return transform; | 
|  | 34 } | 
|  | 35 }  // namespace | 
|  | 36 | 
| 13 namespace cc { | 37 namespace cc { | 
| 14 | 38 | 
| 15 LayerAnimationController::LayerAnimationController(int id) | 39 LayerAnimationController::LayerAnimationController(int id) | 
| 16     : m_forceSync(false) | 40     : m_forceSync(false) | 
| 17     , m_id(id) | 41     , m_id(id) | 
| 18     , m_registrar(0) | 42     , m_registrar(0) | 
| 19     , m_isActive(false) | 43     , m_isActive(false) | 
| 20 { | 44 { | 
| 21 } | 45 } | 
| 22 | 46 | 
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 399 | 423 | 
| 400             // Animation assumes its initial value until it gets the synchronize
     d start time | 424             // Animation assumes its initial value until it gets the synchronize
     d start time | 
| 401             // from the impl thread and can start ticking. | 425             // from the impl thread and can start ticking. | 
| 402             if (m_activeAnimations[i]->needsSynchronizedStartTime()) | 426             if (m_activeAnimations[i]->needsSynchronizedStartTime()) | 
| 403                 trimmed = 0; | 427                 trimmed = 0; | 
| 404 | 428 | 
| 405             switch (m_activeAnimations[i]->targetProperty()) { | 429             switch (m_activeAnimations[i]->targetProperty()) { | 
| 406 | 430 | 
| 407             case ActiveAnimation::Transform: { | 431             case ActiveAnimation::Transform: { | 
| 408                 const TransformAnimationCurve* transformAnimationCurve = m_activ
     eAnimations[i]->curve()->toTransformAnimationCurve(); | 432                 const TransformAnimationCurve* transformAnimationCurve = m_activ
     eAnimations[i]->curve()->toTransformAnimationCurve(); | 
| 409                 const gfx::Transform transform = transformAnimationCurve->getVal
     ue(trimmed).toTransform(); | 433                 const gfx::Transform transform = convertWebTransformationMatrixT
     oTransform(transformAnimationCurve->getValue(trimmed)); | 
| 410                 if (m_activeAnimations[i]->isFinishedAt(monotonicTime)) | 434                 if (m_activeAnimations[i]->isFinishedAt(monotonicTime)) | 
| 411                     m_activeAnimations[i]->setRunState(ActiveAnimation::Finished
     , monotonicTime); | 435                     m_activeAnimations[i]->setRunState(ActiveAnimation::Finished
     , monotonicTime); | 
| 412 | 436 | 
| 413                 notifyObserversTransformAnimated(transform); | 437                 notifyObserversTransformAnimated(transform); | 
| 414                 break; | 438                 break; | 
| 415             } | 439             } | 
| 416 | 440 | 
| 417             case ActiveAnimation::Opacity: { | 441             case ActiveAnimation::Opacity: { | 
| 418                 const FloatAnimationCurve* floatAnimationCurve = m_activeAnimati
     ons[i]->curve()->toFloatAnimationCurve(); | 442                 const FloatAnimationCurve* floatAnimationCurve = m_activeAnimati
     ons[i]->curve()->toFloatAnimationCurve(); | 
| 419                 const float opacity = floatAnimationCurve->getValue(trimmed); | 443                 const float opacity = floatAnimationCurve->getValue(trimmed); | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 451 } | 475 } | 
| 452 | 476 | 
| 453 void LayerAnimationController::notifyObserversTransformAnimated(const gfx::Trans
     form& transform) | 477 void LayerAnimationController::notifyObserversTransformAnimated(const gfx::Trans
     form& transform) | 
| 454 { | 478 { | 
| 455     FOR_EACH_OBSERVER(LayerAnimationValueObserver, | 479     FOR_EACH_OBSERVER(LayerAnimationValueObserver, | 
| 456                       m_observers, | 480                       m_observers, | 
| 457                       OnTransformAnimated(transform)); | 481                       OnTransformAnimated(transform)); | 
| 458 } | 482 } | 
| 459 | 483 | 
| 460 }  // namespace cc | 484 }  // namespace cc | 
| OLD | NEW | 
|---|