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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 if (boundsContainPageScale == m_boundsContainPageScale) | 641 if (boundsContainPageScale == m_boundsContainPageScale) |
642 return; | 642 return; |
643 | 643 |
644 m_boundsContainPageScale = boundsContainPageScale; | 644 m_boundsContainPageScale = boundsContainPageScale; |
645 setNeedsDisplay(); | 645 setNeedsDisplay(); |
646 } | 646 } |
647 | 647 |
648 void LayerChromium::createRenderSurface() | 648 void LayerChromium::createRenderSurface() |
649 { | 649 { |
650 ASSERT(!m_renderSurface); | 650 ASSERT(!m_renderSurface); |
651 m_renderSurface = adoptPtr(new RenderSurfaceChromium(this)); | 651 m_renderSurface = make_scoped_ptr(new RenderSurfaceChromium(this)); |
652 setRenderTarget(this); | 652 setRenderTarget(this); |
653 } | 653 } |
654 | 654 |
655 bool LayerChromium::descendantDrawsContent() | 655 bool LayerChromium::descendantDrawsContent() |
656 { | 656 { |
657 for (size_t i = 0; i < m_children.size(); ++i) { | 657 for (size_t i = 0; i < m_children.size(); ++i) { |
658 if (m_children[i]->drawsContent() || m_children[i]->descendantDrawsConte
nt()) | 658 if (m_children[i]->drawsContent() || m_children[i]->descendantDrawsConte
nt()) |
659 return true; | 659 return true; |
660 } | 660 } |
661 return false; | 661 return false; |
(...skipping 23 matching lines...) Expand all Loading... |
685 } | 685 } |
686 | 686 |
687 void LayerChromium::setTransformFromAnimation(const WebTransformationMatrix& tra
nsform) | 687 void LayerChromium::setTransformFromAnimation(const WebTransformationMatrix& tra
nsform) |
688 { | 688 { |
689 // This is called due to an ongoing accelerated animation. Since this animat
ion is | 689 // This is called due to an ongoing accelerated animation. Since this animat
ion is |
690 // also being run on the impl thread, there is no need to request a commit t
o push | 690 // also being run on the impl thread, there is no need to request a commit t
o push |
691 // this value over, so set this value directly rather than calling setTransf
orm. | 691 // this value over, so set this value directly rather than calling setTransf
orm. |
692 m_transform = transform; | 692 m_transform = transform; |
693 } | 693 } |
694 | 694 |
695 bool LayerChromium::addAnimation(PassOwnPtr<CCActiveAnimation> animation) | 695 bool LayerChromium::addAnimation(scoped_ptr <CCActiveAnimation> animation) |
696 { | 696 { |
697 // WebCore currently assumes that accelerated animations will start soon | 697 // WebCore currently assumes that accelerated animations will start soon |
698 // after the animation is added. However we cannot guarantee that if we do | 698 // after the animation is added. However we cannot guarantee that if we do |
699 // not have a layerTreeHost that will setNeedsCommit(). | 699 // not have a layerTreeHost that will setNeedsCommit(). |
700 if (!m_layerTreeHost) | 700 if (!m_layerTreeHost) |
701 return false; | 701 return false; |
702 | 702 |
703 if (!CCSettings::acceleratedAnimationEnabled()) | 703 if (!CCSettings::acceleratedAnimationEnabled()) |
704 return false; | 704 return false; |
705 | 705 |
706 m_layerAnimationController->addAnimation(animation); | 706 m_layerAnimationController->addAnimation(animation.Pass()); |
707 if (m_layerTreeHost) { | 707 if (m_layerTreeHost) { |
708 m_layerTreeHost->didAddAnimation(); | 708 m_layerTreeHost->didAddAnimation(); |
709 setNeedsCommit(); | 709 setNeedsCommit(); |
710 } | 710 } |
711 return true; | 711 return true; |
712 } | 712 } |
713 | 713 |
714 void LayerChromium::pauseAnimation(int animationId, double timeOffset) | 714 void LayerChromium::pauseAnimation(int animationId, double timeOffset) |
715 { | 715 { |
716 m_layerAnimationController->pauseAnimation(animationId, timeOffset); | 716 m_layerAnimationController->pauseAnimation(animationId, timeOffset); |
(...skipping 11 matching lines...) Expand all Loading... |
728 m_layerAnimationController->suspendAnimations(monotonicTime); | 728 m_layerAnimationController->suspendAnimations(monotonicTime); |
729 setNeedsCommit(); | 729 setNeedsCommit(); |
730 } | 730 } |
731 | 731 |
732 void LayerChromium::resumeAnimations(double monotonicTime) | 732 void LayerChromium::resumeAnimations(double monotonicTime) |
733 { | 733 { |
734 m_layerAnimationController->resumeAnimations(monotonicTime); | 734 m_layerAnimationController->resumeAnimations(monotonicTime); |
735 setNeedsCommit(); | 735 setNeedsCommit(); |
736 } | 736 } |
737 | 737 |
738 void LayerChromium::setLayerAnimationController(PassOwnPtr<CCLayerAnimationContr
oller> layerAnimationController) | 738 void LayerChromium::setLayerAnimationController(scoped_ptr<CCLayerAnimationContr
oller> layerAnimationController) |
739 { | 739 { |
740 m_layerAnimationController = layerAnimationController; | 740 m_layerAnimationController = layerAnimationController.Pass(); |
741 if (m_layerAnimationController) { | 741 if (m_layerAnimationController) { |
742 m_layerAnimationController->setClient(this); | 742 m_layerAnimationController->setClient(this); |
743 m_layerAnimationController->setForceSync(); | 743 m_layerAnimationController->setForceSync(); |
744 } | 744 } |
745 setNeedsCommit(); | 745 setNeedsCommit(); |
746 } | 746 } |
747 | 747 |
748 PassOwnPtr<CCLayerAnimationController> LayerChromium::releaseLayerAnimationContr
oller() | 748 scoped_ptr<CCLayerAnimationController> LayerChromium::releaseLayerAnimationContr
oller() |
749 { | 749 { |
750 OwnPtr<CCLayerAnimationController> toReturn = m_layerAnimationController.rel
ease(); | 750 scoped_ptr<CCLayerAnimationController> toReturn = m_layerAnimationController
.Pass(); |
751 m_layerAnimationController = CCLayerAnimationController::create(this); | 751 m_layerAnimationController = CCLayerAnimationController::create(this); |
752 return toReturn.release(); | 752 return toReturn.Pass(); |
753 } | 753 } |
754 | 754 |
755 bool LayerChromium::hasActiveAnimation() const | 755 bool LayerChromium::hasActiveAnimation() const |
756 { | 756 { |
757 return m_layerAnimationController->hasActiveAnimation(); | 757 return m_layerAnimationController->hasActiveAnimation(); |
758 } | 758 } |
759 | 759 |
760 void LayerChromium::notifyAnimationStarted(const CCAnimationEvent& event, double
wallClockTime) | 760 void LayerChromium::notifyAnimationStarted(const CCAnimationEvent& event, double
wallClockTime) |
761 { | 761 { |
762 m_layerAnimationController->notifyAnimationStarted(event); | 762 m_layerAnimationController->notifyAnimationStarted(event); |
(...skipping 19 matching lines...) Expand all Loading... |
782 return 0; | 782 return 0; |
783 } | 783 } |
784 | 784 |
785 void sortLayers(std::vector<scoped_refptr<LayerChromium> >::iterator, std::vecto
r<scoped_refptr<LayerChromium> >::iterator, void*) | 785 void sortLayers(std::vector<scoped_refptr<LayerChromium> >::iterator, std::vecto
r<scoped_refptr<LayerChromium> >::iterator, void*) |
786 { | 786 { |
787 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort LayerChromiums. | 787 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort LayerChromiums. |
788 } | 788 } |
789 | 789 |
790 } | 790 } |
791 #endif // USE(ACCELERATED_COMPOSITING) | 791 #endif // USE(ACCELERATED_COMPOSITING) |
OLD | NEW |