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 <public/WebTransformationMatrix.h> | 9 #include "ui/gfx/transform.h" |
10 | |
11 using WebKit::WebTransformationMatrix; | |
12 | 10 |
13 namespace cc { | 11 namespace cc { |
14 | 12 |
15 LayerAnimationController::LayerAnimationController(LayerAnimationControllerClien
t* client) | 13 LayerAnimationController::LayerAnimationController(LayerAnimationControllerClien
t* client) |
16 : m_forceSync(false) | 14 : m_forceSync(false) |
17 , m_client(client) | 15 , m_client(client) |
18 { | 16 { |
19 } | 17 } |
20 | 18 |
21 LayerAnimationController::~LayerAnimationController() | 19 LayerAnimationController::~LayerAnimationController() |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 | 364 |
367 // 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 |
368 // from the impl thread and can start ticking. | 366 // from the impl thread and can start ticking. |
369 if (m_activeAnimations[i]->needsSynchronizedStartTime()) | 367 if (m_activeAnimations[i]->needsSynchronizedStartTime()) |
370 trimmed = 0; | 368 trimmed = 0; |
371 | 369 |
372 switch (m_activeAnimations[i]->targetProperty()) { | 370 switch (m_activeAnimations[i]->targetProperty()) { |
373 | 371 |
374 case ActiveAnimation::Transform: { | 372 case ActiveAnimation::Transform: { |
375 const TransformAnimationCurve* transformAnimationCurve = m_activ
eAnimations[i]->curve()->toTransformAnimationCurve(); | 373 const TransformAnimationCurve* transformAnimationCurve = m_activ
eAnimations[i]->curve()->toTransformAnimationCurve(); |
376 const WebTransformationMatrix matrix = transformAnimationCurve->
getValue(trimmed); | 374 const gfx::Transform matrix = transformAnimationCurve->getValue(
trimmed).toTransform(); |
377 if (m_activeAnimations[i]->isFinishedAt(monotonicTime)) | 375 if (m_activeAnimations[i]->isFinishedAt(monotonicTime)) |
378 m_activeAnimations[i]->setRunState(ActiveAnimation::Finished
, monotonicTime); | 376 m_activeAnimations[i]->setRunState(ActiveAnimation::Finished
, monotonicTime); |
379 | 377 |
380 m_client->setTransformFromAnimation(matrix); | 378 m_client->setTransformFromAnimation(matrix); |
381 break; | 379 break; |
382 } | 380 } |
383 | 381 |
384 case ActiveAnimation::Opacity: { | 382 case ActiveAnimation::Opacity: { |
385 const FloatAnimationCurve* floatAnimationCurve = m_activeAnimati
ons[i]->curve()->toFloatAnimationCurve(); | 383 const FloatAnimationCurve* floatAnimationCurve = m_activeAnimati
ons[i]->curve()->toFloatAnimationCurve(); |
386 const float opacity = floatAnimationCurve->getValue(trimmed); | 384 const float opacity = floatAnimationCurve->getValue(trimmed); |
387 if (m_activeAnimations[i]->isFinishedAt(monotonicTime)) | 385 if (m_activeAnimations[i]->isFinishedAt(monotonicTime)) |
388 m_activeAnimations[i]->setRunState(ActiveAnimation::Finished
, monotonicTime); | 386 m_activeAnimations[i]->setRunState(ActiveAnimation::Finished
, monotonicTime); |
389 | 387 |
390 m_client->setOpacityFromAnimation(opacity); | 388 m_client->setOpacityFromAnimation(opacity); |
391 break; | 389 break; |
392 } | 390 } |
393 | 391 |
394 // Do nothing for sentinel value. | 392 // Do nothing for sentinel value. |
395 case ActiveAnimation::TargetPropertyEnumSize: | 393 case ActiveAnimation::TargetPropertyEnumSize: |
396 NOTREACHED(); | 394 NOTREACHED(); |
397 } | 395 } |
398 } | 396 } |
399 } | 397 } |
400 } | 398 } |
401 | 399 |
402 } // namespace cc | 400 } // namespace cc |
OLD | NEW |