| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #if USE(ACCELERATED_COMPOSITING) | 7 #if USE(ACCELERATED_COMPOSITING) |
| 8 #include "LayerChromium.h" | 8 #include "LayerChromium.h" |
| 9 | 9 |
| 10 #include "CCActiveAnimation.h" | 10 #include "CCActiveAnimation.h" |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 if (boundsContainPageScale == m_boundsContainPageScale) | 649 if (boundsContainPageScale == m_boundsContainPageScale) |
| 650 return; | 650 return; |
| 651 | 651 |
| 652 m_boundsContainPageScale = boundsContainPageScale; | 652 m_boundsContainPageScale = boundsContainPageScale; |
| 653 setNeedsDisplay(); | 653 setNeedsDisplay(); |
| 654 } | 654 } |
| 655 | 655 |
| 656 void LayerChromium::createRenderSurface() | 656 void LayerChromium::createRenderSurface() |
| 657 { | 657 { |
| 658 ASSERT(!m_renderSurface); | 658 ASSERT(!m_renderSurface); |
| 659 m_renderSurface = adoptPtr(new RenderSurfaceChromium(this)); | 659 m_renderSurface = make_scoped_ptr(new RenderSurfaceChromium(this)); |
| 660 setRenderTarget(this); | 660 setRenderTarget(this); |
| 661 } | 661 } |
| 662 | 662 |
| 663 bool LayerChromium::descendantDrawsContent() | 663 bool LayerChromium::descendantDrawsContent() |
| 664 { | 664 { |
| 665 for (size_t i = 0; i < m_children.size(); ++i) { | 665 for (size_t i = 0; i < m_children.size(); ++i) { |
| 666 if (m_children[i]->drawsContent() || m_children[i]->descendantDrawsConte
nt()) | 666 if (m_children[i]->drawsContent() || m_children[i]->descendantDrawsConte
nt()) |
| 667 return true; | 667 return true; |
| 668 } | 668 } |
| 669 return false; | 669 return false; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 693 } | 693 } |
| 694 | 694 |
| 695 void LayerChromium::setTransformFromAnimation(const WebTransformationMatrix& tra
nsform) | 695 void LayerChromium::setTransformFromAnimation(const WebTransformationMatrix& tra
nsform) |
| 696 { | 696 { |
| 697 // This is called due to an ongoing accelerated animation. Since this animat
ion is | 697 // This is called due to an ongoing accelerated animation. Since this animat
ion is |
| 698 // also being run on the impl thread, there is no need to request a commit t
o push | 698 // also being run on the impl thread, there is no need to request a commit t
o push |
| 699 // this value over, so set this value directly rather than calling setTransf
orm. | 699 // this value over, so set this value directly rather than calling setTransf
orm. |
| 700 m_transform = transform; | 700 m_transform = transform; |
| 701 } | 701 } |
| 702 | 702 |
| 703 bool LayerChromium::addAnimation(PassOwnPtr<CCActiveAnimation> animation) | 703 bool LayerChromium::addAnimation(scoped_ptr <CCActiveAnimation> animation) |
| 704 { | 704 { |
| 705 // WebCore currently assumes that accelerated animations will start soon | 705 // WebCore currently assumes that accelerated animations will start soon |
| 706 // after the animation is added. However we cannot guarantee that if we do | 706 // after the animation is added. However we cannot guarantee that if we do |
| 707 // not have a layerTreeHost that will setNeedsCommit(). | 707 // not have a layerTreeHost that will setNeedsCommit(). |
| 708 if (!m_layerTreeHost) | 708 if (!m_layerTreeHost) |
| 709 return false; | 709 return false; |
| 710 | 710 |
| 711 if (!CCSettings::acceleratedAnimationEnabled()) | 711 if (!CCSettings::acceleratedAnimationEnabled()) |
| 712 return false; | 712 return false; |
| 713 | 713 |
| 714 m_layerAnimationController->addAnimation(animation); | 714 m_layerAnimationController->addAnimation(animation.Pass()); |
| 715 if (m_layerTreeHost) { | 715 if (m_layerTreeHost) { |
| 716 m_layerTreeHost->didAddAnimation(); | 716 m_layerTreeHost->didAddAnimation(); |
| 717 setNeedsCommit(); | 717 setNeedsCommit(); |
| 718 } | 718 } |
| 719 return true; | 719 return true; |
| 720 } | 720 } |
| 721 | 721 |
| 722 void LayerChromium::pauseAnimation(int animationId, double timeOffset) | 722 void LayerChromium::pauseAnimation(int animationId, double timeOffset) |
| 723 { | 723 { |
| 724 m_layerAnimationController->pauseAnimation(animationId, timeOffset); | 724 m_layerAnimationController->pauseAnimation(animationId, timeOffset); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 736 m_layerAnimationController->suspendAnimations(monotonicTime); | 736 m_layerAnimationController->suspendAnimations(monotonicTime); |
| 737 setNeedsCommit(); | 737 setNeedsCommit(); |
| 738 } | 738 } |
| 739 | 739 |
| 740 void LayerChromium::resumeAnimations(double monotonicTime) | 740 void LayerChromium::resumeAnimations(double monotonicTime) |
| 741 { | 741 { |
| 742 m_layerAnimationController->resumeAnimations(monotonicTime); | 742 m_layerAnimationController->resumeAnimations(monotonicTime); |
| 743 setNeedsCommit(); | 743 setNeedsCommit(); |
| 744 } | 744 } |
| 745 | 745 |
| 746 void LayerChromium::setLayerAnimationController(PassOwnPtr<CCLayerAnimationContr
oller> layerAnimationController) | 746 void LayerChromium::setLayerAnimationController(scoped_ptr<CCLayerAnimationContr
oller> layerAnimationController) |
| 747 { | 747 { |
| 748 m_layerAnimationController = layerAnimationController; | 748 m_layerAnimationController = layerAnimationController.Pass(); |
| 749 if (m_layerAnimationController) { | 749 if (m_layerAnimationController) { |
| 750 m_layerAnimationController->setClient(this); | 750 m_layerAnimationController->setClient(this); |
| 751 m_layerAnimationController->setForceSync(); | 751 m_layerAnimationController->setForceSync(); |
| 752 } | 752 } |
| 753 setNeedsCommit(); | 753 setNeedsCommit(); |
| 754 } | 754 } |
| 755 | 755 |
| 756 PassOwnPtr<CCLayerAnimationController> LayerChromium::releaseLayerAnimationContr
oller() | 756 scoped_ptr<CCLayerAnimationController> LayerChromium::releaseLayerAnimationContr
oller() |
| 757 { | 757 { |
| 758 OwnPtr<CCLayerAnimationController> toReturn = m_layerAnimationController.rel
ease(); | 758 scoped_ptr<CCLayerAnimationController> toReturn = m_layerAnimationController
.Pass(); |
| 759 m_layerAnimationController = CCLayerAnimationController::create(this); | 759 m_layerAnimationController = CCLayerAnimationController::create(this); |
| 760 return toReturn.release(); | 760 return toReturn.Pass(); |
| 761 } | 761 } |
| 762 | 762 |
| 763 bool LayerChromium::hasActiveAnimation() const | 763 bool LayerChromium::hasActiveAnimation() const |
| 764 { | 764 { |
| 765 return m_layerAnimationController->hasActiveAnimation(); | 765 return m_layerAnimationController->hasActiveAnimation(); |
| 766 } | 766 } |
| 767 | 767 |
| 768 void LayerChromium::notifyAnimationStarted(const CCAnimationEvent& event, double
wallClockTime) | 768 void LayerChromium::notifyAnimationStarted(const CCAnimationEvent& event, double
wallClockTime) |
| 769 { | 769 { |
| 770 m_layerAnimationController->notifyAnimationStarted(event); | 770 m_layerAnimationController->notifyAnimationStarted(event); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 790 return 0; | 790 return 0; |
| 791 } | 791 } |
| 792 | 792 |
| 793 void sortLayers(std::vector<scoped_refptr<LayerChromium> >::iterator, std::vecto
r<scoped_refptr<LayerChromium> >::iterator, void*) | 793 void sortLayers(std::vector<scoped_refptr<LayerChromium> >::iterator, std::vecto
r<scoped_refptr<LayerChromium> >::iterator, void*) |
| 794 { | 794 { |
| 795 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort LayerChromiums. | 795 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort LayerChromiums. |
| 796 } | 796 } |
| 797 | 797 |
| 798 } | 798 } |
| 799 #endif // USE(ACCELERATED_COMPOSITING) | 799 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |