| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_tree_host.h" | 5 #include "cc/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/synchronization/lock.h" | 7 #include "base/synchronization/lock.h" |
| 8 #include "cc/content_layer.h" | 8 #include "cc/content_layer.h" |
| 9 #include "cc/content_layer_client.h" | 9 #include "cc/content_layer_client.h" |
| 10 #include "cc/layer_impl.h" | 10 #include "cc/layer_impl.h" |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 , m_receivedAnimationStartedNotification(false) | 597 , m_receivedAnimationStartedNotification(false) |
| 598 , m_startTime(0) | 598 , m_startTime(0) |
| 599 { | 599 { |
| 600 } | 600 } |
| 601 | 601 |
| 602 virtual void beginTest() OVERRIDE | 602 virtual void beginTest() OVERRIDE |
| 603 { | 603 { |
| 604 postAddInstantAnimationToMainThread(); | 604 postAddInstantAnimationToMainThread(); |
| 605 } | 605 } |
| 606 | 606 |
| 607 virtual void animateLayers(LayerTreeHostImpl* layerTreeHostImpl, base::TimeT
icks monotonicTime) OVERRIDE | 607 virtual void animateLayers(LayerTreeHostImpl* layerTreeHostImpl, base::TimeT
icks monotonicTime, bool hasUnfinishedAnimation) OVERRIDE |
| 608 { | 608 { |
| 609 if (!m_numAnimates) { | 609 if (!m_numAnimates) { |
| 610 // The animation had zero duration so layerTreeHostImpl should no | 610 // The animation had zero duration so layerTreeHostImpl should no |
| 611 // longer need to animate its layers. | 611 // longer need to animate its layers. |
| 612 EXPECT_FALSE(layerTreeHostImpl->needsAnimateLayers()); | 612 EXPECT_FALSE(hasUnfinishedAnimation); |
| 613 m_numAnimates++; | 613 m_numAnimates++; |
| 614 m_firstMonotonicTime = monotonicTime; | 614 m_firstMonotonicTime = monotonicTime; |
| 615 return; | 615 return; |
| 616 } | 616 } |
| 617 EXPECT_LT(0, m_startTime); | 617 EXPECT_LT(0, m_startTime); |
| 618 EXPECT_TRUE(m_receivedAnimationStartedNotification); | 618 EXPECT_TRUE(m_receivedAnimationStartedNotification); |
| 619 endTest(); | 619 endTest(); |
| 620 } | 620 } |
| 621 | 621 |
| 622 virtual void notifyAnimationStarted(double wallClockTime) OVERRIDE | 622 virtual void notifyAnimationStarted(double wallClockTime) OVERRIDE |
| (...skipping 29 matching lines...) Expand all Loading... |
| 652 | 652 |
| 653 virtual void beginTest() OVERRIDE | 653 virtual void beginTest() OVERRIDE |
| 654 { | 654 { |
| 655 postAddAnimationToMainThread(m_layerTreeHost->rootLayer()); | 655 postAddAnimationToMainThread(m_layerTreeHost->rootLayer()); |
| 656 } | 656 } |
| 657 | 657 |
| 658 virtual void afterTest() OVERRIDE | 658 virtual void afterTest() OVERRIDE |
| 659 { | 659 { |
| 660 } | 660 } |
| 661 | 661 |
| 662 virtual void animateLayers(LayerTreeHostImpl* layerTreeHostImpl, base::TimeT
icks monotonicTime) OVERRIDE | 662 virtual void animateLayers(LayerTreeHostImpl* layerTreeHostImpl, base::TimeT
icks monotonicTime, bool hasUnfinishedAnimation) OVERRIDE |
| 663 { | 663 { |
| 664 m_startedAnimating = true; | 664 m_startedAnimating = true; |
| 665 } | 665 } |
| 666 | 666 |
| 667 virtual void drawLayersOnThread(LayerTreeHostImpl*) OVERRIDE | 667 virtual void drawLayersOnThread(LayerTreeHostImpl*) OVERRIDE |
| 668 { | 668 { |
| 669 if (m_startedAnimating) | 669 if (m_startedAnimating) |
| 670 endTest(); | 670 endTest(); |
| 671 } | 671 } |
| 672 | 672 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 public: | 729 public: |
| 730 LayerTreeHostTestAddAnimationWithTimingFunction() | 730 LayerTreeHostTestAddAnimationWithTimingFunction() |
| 731 { | 731 { |
| 732 } | 732 } |
| 733 | 733 |
| 734 virtual void beginTest() OVERRIDE | 734 virtual void beginTest() OVERRIDE |
| 735 { | 735 { |
| 736 postAddAnimationToMainThread(m_layerTreeHost->rootLayer()); | 736 postAddAnimationToMainThread(m_layerTreeHost->rootLayer()); |
| 737 } | 737 } |
| 738 | 738 |
| 739 virtual void animateLayers(LayerTreeHostImpl* layerTreeHostImpl, base::TimeT
icks monotonicTime) OVERRIDE | 739 virtual void animateLayers(LayerTreeHostImpl* layerTreeHostImpl, base::TimeT
icks monotonicTime, bool hasUnfinishedAnimation) OVERRIDE |
| 740 { | 740 { |
| 741 const ActiveAnimation* animation = m_layerTreeHost->rootLayer()->layerAn
imationController()->getActiveAnimation(0, ActiveAnimation::Opacity); | 741 const ActiveAnimation* animation = m_layerTreeHost->rootLayer()->layerAn
imationController()->getActiveAnimation(0, ActiveAnimation::Opacity); |
| 742 if (!animation) | 742 if (!animation) |
| 743 return; | 743 return; |
| 744 const FloatAnimationCurve* curve = animation->curve()->toFloatAnimationC
urve(); | 744 const FloatAnimationCurve* curve = animation->curve()->toFloatAnimationC
urve(); |
| 745 float startOpacity = curve->getValue(0); | 745 float startOpacity = curve->getValue(0); |
| 746 float endOpacity = curve->getValue(curve->duration()); | 746 float endOpacity = curve->getValue(curve->duration()); |
| 747 float linearlyInterpolatedOpacity = 0.25 * endOpacity + 0.75 * startOpac
ity; | 747 float linearlyInterpolatedOpacity = 0.25 * endOpacity + 0.75 * startOpac
ity; |
| 748 double time = curve->duration() * 0.25; | 748 double time = curve->duration() * 0.25; |
| 749 // If the linear timing function associated with this animation was not
picked up, | 749 // If the linear timing function associated with this animation was not
picked up, |
| (...skipping 2630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3380 LayerTreeSettings settings; | 3380 LayerTreeSettings settings; |
| 3381 settings.maxPartialTextureUpdates = 4; | 3381 settings.maxPartialTextureUpdates = 4; |
| 3382 | 3382 |
| 3383 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc
oped_ptr<Thread>()); | 3383 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc
oped_ptr<Thread>()); |
| 3384 EXPECT_TRUE(host->initializeRendererIfNeeded()); | 3384 EXPECT_TRUE(host->initializeRendererIfNeeded()); |
| 3385 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates); | 3385 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates); |
| 3386 } | 3386 } |
| 3387 | 3387 |
| 3388 } // namespace | 3388 } // namespace |
| 3389 } // namespace cc | 3389 } // namespace cc |
| OLD | NEW |