Changeset 56158 in webkit
- Timestamp:
- Mar 18, 2010 7:42:22 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r56155 r56158 1 2010-03-18 Noam Rosenthal <noam.rosenthal@nokia.com> 2 3 Reviewed by Antti Koivisto. 4 5 [Qt] [Performance] GraphicsLayerQt updates the scene too often 6 https://bugs.webkit.org/show_bug.cgi?id=36158 7 8 This fix makes sure that flushChanges is only called when necessary, 9 by calling the notifySync function asynchronously, which makes sure flushChanges() is called 10 after the WebCore compositor has made all its changes. 11 12 This has shown a visual improvement on several test-cases. 13 14 * Makefile: 15 * platform/graphics/qt/GraphicsLayerQt.cpp: 16 (WebCore::GraphicsLayerQtImpl::): 17 (WebCore::GraphicsLayerQtImpl::notifySyncRequired): 18 (WebCore::GraphicsLayerQtImpl::notifyChange): 19 (WebCore::GraphicsLayerQtImpl::flushChanges): 20 (WebCore::GraphicsLayerQt::setMaskLayer): 21 (WebCore::GraphicsLayerQt::setPosition): 22 (WebCore::GraphicsLayerQt::setAnchorPoint): 23 (WebCore::GraphicsLayerQt::setSize): 24 (WebCore::GraphicsLayerQt::setTransform): 25 (WebCore::GraphicsLayerQt::setChildrenTransform): 26 (WebCore::GraphicsLayerQt::setPreserves3D): 27 (WebCore::GraphicsLayerQt::setMasksToBounds): 28 (WebCore::GraphicsLayerQt::setDrawsContent): 29 (WebCore::GraphicsLayerQt::setBackgroundColor): 30 (WebCore::GraphicsLayerQt::clearBackgroundColor): 31 (WebCore::GraphicsLayerQt::setContentsOpaque): 32 (WebCore::GraphicsLayerQt::setBackfaceVisibility): 33 (WebCore::GraphicsLayerQt::setOpacity): 34 (WebCore::GraphicsLayerQt::setContentsRect): 35 1 36 2010-03-18 Stephen White <senorblanco@chromium.org> 2 37 -
trunk/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
r55967 r56158 30 30 #include <QtCore/qabstractanimation.h> 31 31 #include <QtCore/qdebug.h> 32 #include <QtCore/qmetaobject.h> 32 33 #include <QtCore/qset.h> 33 34 #include <QtCore/qtimer.h> … … 102 103 enum ChangeMask { 103 104 NoChanges = 0, 105 106 ParentChange = (1L << 0), 104 107 ChildrenChange = (1L << 1), 105 108 MaskLayerChange = (1L << 2), 106 109 PositionChange = (1L << 3), 110 107 111 AnchorPointChange = (1L << 4), 108 112 SizeChange = (1L << 5), 109 113 TransformChange = (1L << 6), 110 114 ContentChange = (1L << 7), 115 111 116 GeometryOrientationChange = (1L << 8), 112 117 ContentsOrientationChange = (1L << 9), 113 118 OpacityChange = (1L << 10), 114 119 ContentsRectChange = (1L << 11), 120 115 121 Preserves3DChange = (1L << 12), 116 122 MasksToBoundsChange = (1L << 13), 117 123 DrawsContentChange = (1L << 14), 118 124 ContentsOpaqueChange = (1L << 15), 125 119 126 BackfaceVisibilityChange = (1L << 16), 120 127 ChildrenTransformChange = (1L << 17), 121 128 DisplayChange = (1L << 18), 122 129 BackgroundColorChange = (1L << 19), 123 ParentChange = (1L << 20), 124 DistributesOpacityChange = (1L << 2 1)130 131 DistributesOpacityChange = (1L << 20) 125 132 }; 126 133 … … 161 168 // we need to notify the client (aka the layer compositor) when the animation actually starts 162 169 void notifyAnimationStarted(); 170 171 // we notify WebCore of a layer changed asynchronously; otherwise we end up calling flushChanges too often. 172 void notifySyncRequired(); 163 173 164 174 signals: … … 391 401 } 392 402 393 void GraphicsLayerQtImpl::notifyChange(ChangeMask changeMask) 394 { 395 Q_ASSERT(this); 396 397 m_changeMask |= changeMask; 398 403 void GraphicsLayerQtImpl::notifySyncRequired() 404 { 399 405 if (m_layer->client()) 400 406 m_layer->client()->notifySyncRequired(m_layer); 407 } 408 409 void GraphicsLayerQtImpl::notifyChange(ChangeMask changeMask) 410 { 411 m_changeMask |= changeMask; 412 static QMetaMethod syncMethod = staticMetaObject.method(staticMetaObject.indexOfMethod("notifySyncRequired()")); 413 syncMethod.invoke(this, Qt::QueuedConnection); 401 414 } 402 415 … … 522 535 } 523 536 524 if ((m_changeMask & OpacityChange) && m_state.opacity != m_layer->opacity() )537 if ((m_changeMask & OpacityChange) && m_state.opacity != m_layer->opacity() && !m_opacityAnimationRunning) 525 538 setOpacity(m_layer->opacity()); 526 539 … … 710 723 711 724 // reimp from GraphicsLayer.h 712 void GraphicsLayerQt::setMaskLayer(GraphicsLayer* layer) 713 { 714 GraphicsLayer::setMaskLayer(layer); 725 void GraphicsLayerQt::setMaskLayer(GraphicsLayer* value) 726 { 727 if (value == maskLayer()) 728 return; 729 GraphicsLayer::setMaskLayer(value); 715 730 m_impl->notifyChange(GraphicsLayerQtImpl::MaskLayerChange); 716 731 } 717 732 718 733 // reimp from GraphicsLayer.h 719 void GraphicsLayerQt::setPosition(const FloatPoint& p) 720 { 721 if (position() != p) 722 m_impl->notifyChange(GraphicsLayerQtImpl::PositionChange); 723 GraphicsLayer::setPosition(p); 724 } 725 726 // reimp from GraphicsLayer.h 727 void GraphicsLayerQt::setAnchorPoint(const FloatPoint3D& p) 728 { 729 if (anchorPoint() != p) 730 m_impl->notifyChange(GraphicsLayerQtImpl::AnchorPointChange); 731 GraphicsLayer::setAnchorPoint(p); 732 } 733 734 // reimp from GraphicsLayer.h 735 void GraphicsLayerQt::setSize(const FloatSize& size) 736 { 737 if (this->size() != size) 738 m_impl->notifyChange(GraphicsLayerQtImpl::SizeChange); 739 GraphicsLayer::setSize(size); 740 } 741 742 // reimp from GraphicsLayer.h 743 void GraphicsLayerQt::setTransform(const TransformationMatrix& t) 744 { 745 if (!m_impl->m_transformAnimationRunning && transform() != t) 746 m_impl->notifyChange(GraphicsLayerQtImpl::TransformChange); 747 GraphicsLayer::setTransform(t); 748 } 749 750 // reimp from GraphicsLayer.h 751 void GraphicsLayerQt::setChildrenTransform(const TransformationMatrix& t) 752 { 753 GraphicsLayer::setChildrenTransform(t); 734 void GraphicsLayerQt::setPosition(const FloatPoint& value) 735 { 736 if (value == position()) 737 return; 738 GraphicsLayer::setPosition(value); 739 m_impl->notifyChange(GraphicsLayerQtImpl::PositionChange); 740 } 741 742 // reimp from GraphicsLayer.h 743 void GraphicsLayerQt::setAnchorPoint(const FloatPoint3D& value) 744 { 745 if (value == anchorPoint()) 746 return; 747 GraphicsLayer::setAnchorPoint(value); 748 m_impl->notifyChange(GraphicsLayerQtImpl::AnchorPointChange); 749 } 750 751 // reimp from GraphicsLayer.h 752 void GraphicsLayerQt::setSize(const FloatSize& value) 753 { 754 if (value == size()) 755 return; 756 GraphicsLayer::setSize(value); 757 m_impl->notifyChange(GraphicsLayerQtImpl::SizeChange); 758 } 759 760 // reimp from GraphicsLayer.h 761 void GraphicsLayerQt::setTransform(const TransformationMatrix& value) 762 { 763 if (value == transform()) 764 return; 765 GraphicsLayer::setTransform(value); 766 m_impl->notifyChange(GraphicsLayerQtImpl::TransformChange); 767 } 768 769 // reimp from GraphicsLayer.h 770 void GraphicsLayerQt::setChildrenTransform(const TransformationMatrix& value) 771 { 772 if (value == childrenTransform()) 773 return; 774 GraphicsLayer::setChildrenTransform(value); 754 775 m_impl->notifyChange(GraphicsLayerQtImpl::ChildrenTransformChange); 755 776 } 756 777 757 778 // reimp from GraphicsLayer.h 758 void GraphicsLayerQt::setPreserves3D(bool b) 759 { 760 if (b != preserves3D()); 761 m_impl->notifyChange(GraphicsLayerQtImpl::Preserves3DChange); 762 GraphicsLayer::setPreserves3D(b); 763 } 764 765 // reimp from GraphicsLayer.h 766 void GraphicsLayerQt::setMasksToBounds(bool b) 767 { 768 GraphicsLayer::setMasksToBounds(b); 779 void GraphicsLayerQt::setPreserves3D(bool value) 780 { 781 if (value == preserves3D()) 782 return; 783 GraphicsLayer::setPreserves3D(value); 784 m_impl->notifyChange(GraphicsLayerQtImpl::Preserves3DChange); 785 } 786 787 // reimp from GraphicsLayer.h 788 void GraphicsLayerQt::setMasksToBounds(bool value) 789 { 790 if (value == masksToBounds()) 791 return; 792 GraphicsLayer::setMasksToBounds(value); 769 793 m_impl->notifyChange(GraphicsLayerQtImpl::MasksToBoundsChange); 770 794 } 771 795 772 796 // reimp from GraphicsLayer.h 773 void GraphicsLayerQt::setDrawsContent(bool b) 774 { 797 void GraphicsLayerQt::setDrawsContent(bool value) 798 { 799 if (value == drawsContent()) 800 return; 775 801 m_impl->notifyChange(GraphicsLayerQtImpl::DrawsContentChange); 776 GraphicsLayer::setDrawsContent(b); 777 } 778 779 // reimp from GraphicsLayer.h 780 void GraphicsLayerQt::setBackgroundColor(const Color& c) 781 { 802 GraphicsLayer::setDrawsContent(value); 803 } 804 805 // reimp from GraphicsLayer.h 806 void GraphicsLayerQt::setBackgroundColor(const Color& value) 807 { 808 if (value == m_impl->m_pendingContent.backgroundColor) 809 return; 810 m_impl->m_pendingContent.backgroundColor = value; 811 GraphicsLayer::setBackgroundColor(value); 782 812 m_impl->notifyChange(GraphicsLayerQtImpl::BackgroundColorChange); 783 m_impl->m_pendingContent.backgroundColor = c;784 GraphicsLayer::setBackgroundColor(c);785 813 } 786 814 … … 788 816 void GraphicsLayerQt::clearBackgroundColor() 789 817 { 818 if (!m_impl->m_pendingContent.backgroundColor.isValid()) 819 return; 790 820 m_impl->m_pendingContent.backgroundColor = QColor(); 821 GraphicsLayer::clearBackgroundColor(); 791 822 m_impl->notifyChange(GraphicsLayerQtImpl::BackgroundColorChange); 792 GraphicsLayer::clearBackgroundColor(); 793 } 794 795 // reimp from GraphicsLayer.h 796 void GraphicsLayerQt::setContentsOpaque(bool b) 797 { 823 } 824 825 // reimp from GraphicsLayer.h 826 void GraphicsLayerQt::setContentsOpaque(bool value) 827 { 828 if (value == contentsOpaque()) 829 return; 798 830 m_impl->notifyChange(GraphicsLayerQtImpl::ContentsOpaqueChange); 799 GraphicsLayer::setContentsOpaque(b); 800 } 801 802 // reimp from GraphicsLayer.h 803 void GraphicsLayerQt::setBackfaceVisibility(bool b) 804 { 831 GraphicsLayer::setContentsOpaque(value); 832 } 833 834 // reimp from GraphicsLayer.h 835 void GraphicsLayerQt::setBackfaceVisibility(bool value) 836 { 837 if (value == backfaceVisibility()) 838 return; 839 GraphicsLayer::setBackfaceVisibility(value); 805 840 m_impl->notifyChange(GraphicsLayerQtImpl::BackfaceVisibilityChange); 806 GraphicsLayer::setBackfaceVisibility(b); 807 } 808 809 // reimp from GraphicsLayer.h 810 void GraphicsLayerQt::setOpacity(float o) 811 { 812 if (!m_impl->m_opacityAnimationRunning && opacity() != o) 813 m_impl->notifyChange(GraphicsLayerQtImpl::OpacityChange); 814 GraphicsLayer::setOpacity(o); 815 } 816 817 // reimp from GraphicsLayer.h 818 void GraphicsLayerQt::setContentsRect(const IntRect& r) 819 { 841 } 842 843 // reimp from GraphicsLayer.h 844 void GraphicsLayerQt::setOpacity(float value) 845 { 846 if (value == opacity()) 847 return; 848 GraphicsLayer::setOpacity(value); 849 m_impl->notifyChange(GraphicsLayerQtImpl::OpacityChange); 850 } 851 852 // reimp from GraphicsLayer.h 853 void GraphicsLayerQt::setContentsRect(const IntRect& value) 854 { 855 if (value == contentsRect()) 856 return; 857 GraphicsLayer::setContentsRect(value); 820 858 m_impl->notifyChange(GraphicsLayerQtImpl::ContentsRectChange); 821 GraphicsLayer::setContentsRect(r);822 859 } 823 860
Note: See TracChangeset
for help on using the changeset viewer.