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

Side by Side Diff: cc/layer_animation_controller.cc

Issue 12035029: Finish migrating cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix nits Created 7 years, 11 months 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
« no previous file with comments | « cc/keyframed_animation_curve_unittest.cc ('k') | cc/test/animation_test_common.h » ('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 <algorithm> 7 #include <algorithm>
8 8
9 #include "cc/animation.h" 9 #include "cc/animation.h"
10 #include "cc/animation_registrar.h" 10 #include "cc/animation_registrar.h"
11 #include "cc/keyframed_animation_curve.h" 11 #include "cc/keyframed_animation_curve.h"
12 #include "cc/layer_animation_value_observer.h" 12 #include "cc/layer_animation_value_observer.h"
13 #include "cc/scoped_ptr_algorithm.h" 13 #include "cc/scoped_ptr_algorithm.h"
14 #include "ui/gfx/transform.h" 14 #include "ui/gfx/transform.h"
15 15
16 namespace {
17 gfx::Transform convertWebTransformationMatrixToTransform(const WebKit::WebTransf ormationMatrix& matrix)
18 {
19 gfx::Transform transform;
20 transform.matrix().setDouble(0, 0, matrix.m11());
21 transform.matrix().setDouble(0, 1, matrix.m21());
22 transform.matrix().setDouble(0, 2, matrix.m31());
23 transform.matrix().setDouble(0, 3, matrix.m41());
24 transform.matrix().setDouble(1, 0, matrix.m12());
25 transform.matrix().setDouble(1, 1, matrix.m22());
26 transform.matrix().setDouble(1, 2, matrix.m32());
27 transform.matrix().setDouble(1, 3, matrix.m42());
28 transform.matrix().setDouble(2, 0, matrix.m13());
29 transform.matrix().setDouble(2, 1, matrix.m23());
30 transform.matrix().setDouble(2, 2, matrix.m33());
31 transform.matrix().setDouble(2, 3, matrix.m43());
32 transform.matrix().setDouble(3, 0, matrix.m14());
33 transform.matrix().setDouble(3, 1, matrix.m24());
34 transform.matrix().setDouble(3, 2, matrix.m34());
35 transform.matrix().setDouble(3, 3, matrix.m44());
36 return transform;
37 }
38 } // namespace
39
40 namespace cc { 16 namespace cc {
41 17
42 LayerAnimationController::LayerAnimationController(int id) 18 LayerAnimationController::LayerAnimationController(int id)
43 : m_forceSync(false) 19 : m_forceSync(false)
44 , m_id(id) 20 , m_id(id)
45 , m_registrar(0) 21 , m_registrar(0)
46 , m_isActive(false) 22 , m_isActive(false)
47 { 23 {
48 } 24 }
49 25
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 412
437 // Animation assumes its initial value until it gets the synchronize d start time 413 // Animation assumes its initial value until it gets the synchronize d start time
438 // from the impl thread and can start ticking. 414 // from the impl thread and can start ticking.
439 if (m_activeAnimations[i]->needsSynchronizedStartTime()) 415 if (m_activeAnimations[i]->needsSynchronizedStartTime())
440 trimmed = 0; 416 trimmed = 0;
441 417
442 switch (m_activeAnimations[i]->targetProperty()) { 418 switch (m_activeAnimations[i]->targetProperty()) {
443 419
444 case Animation::Transform: { 420 case Animation::Transform: {
445 const TransformAnimationCurve* transformAnimationCurve = m_activ eAnimations[i]->curve()->toTransformAnimationCurve(); 421 const TransformAnimationCurve* transformAnimationCurve = m_activ eAnimations[i]->curve()->toTransformAnimationCurve();
446 const gfx::Transform transform = convertWebTransformationMatrixT oTransform(transformAnimationCurve->getValue(trimmed)); 422 const gfx::Transform transform = transformAnimationCurve->getVal ue(trimmed);
447 if (m_activeAnimations[i]->isFinishedAt(monotonicTime)) 423 if (m_activeAnimations[i]->isFinishedAt(monotonicTime))
448 m_activeAnimations[i]->setRunState(Animation::Finished, mono tonicTime); 424 m_activeAnimations[i]->setRunState(Animation::Finished, mono tonicTime);
449 425
450 notifyObserversTransformAnimated(transform); 426 notifyObserversTransformAnimated(transform);
451 break; 427 break;
452 } 428 }
453 429
454 case Animation::Opacity: { 430 case Animation::Opacity: {
455 const FloatAnimationCurve* floatAnimationCurve = m_activeAnimati ons[i]->curve()->toFloatAnimationCurve(); 431 const FloatAnimationCurve* floatAnimationCurve = m_activeAnimati ons[i]->curve()->toFloatAnimationCurve();
456 const float opacity = floatAnimationCurve->getValue(trimmed); 432 const float opacity = floatAnimationCurve->getValue(trimmed);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 ObserverListBase<LayerAnimationValueObserver>::Iterator it(m_observers); 476 ObserverListBase<LayerAnimationValueObserver>::Iterator it(m_observers);
501 LayerAnimationValueObserver* obs; 477 LayerAnimationValueObserver* obs;
502 while ((obs = it.GetNext()) != NULL) 478 while ((obs = it.GetNext()) != NULL)
503 if (obs->IsActive()) 479 if (obs->IsActive())
504 return true; 480 return true;
505 } 481 }
506 return false; 482 return false;
507 } 483 }
508 484
509 } // namespace cc 485 } // namespace cc
OLDNEW
« no previous file with comments | « cc/keyframed_animation_curve_unittest.cc ('k') | cc/test/animation_test_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698