| 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "CCLayerTreeHostImpl.h" | 7 #include "CCLayerTreeHostImpl.h" |
| 8 | 8 |
| 9 #include "CCAnimationTestCommon.h" | 9 #include "CCAnimationTestCommon.h" |
| 10 #include "CCGeometryTestUtils.h" | 10 #include "CCGeometryTestUtils.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 public: | 51 public: |
| 52 CCLayerTreeHostImplTest() | 52 CCLayerTreeHostImplTest() |
| 53 : m_onCanDrawStateChangedCalled(false) | 53 : m_onCanDrawStateChangedCalled(false) |
| 54 , m_didRequestCommit(false) | 54 , m_didRequestCommit(false) |
| 55 , m_didRequestRedraw(false) | 55 , m_didRequestRedraw(false) |
| 56 { | 56 { |
| 57 CCLayerTreeSettings settings; | 57 CCLayerTreeSettings settings; |
| 58 settings.minimumOcclusionTrackingSize = IntSize(); | 58 settings.minimumOcclusionTrackingSize = IntSize(); |
| 59 | 59 |
| 60 m_hostImpl = CCLayerTreeHostImpl::create(settings, this); | 60 m_hostImpl = CCLayerTreeHostImpl::create(settings, this); |
| 61 m_hostImpl->initializeRenderer(createContext(), UnthrottledUploader); | 61 m_hostImpl->initializeRenderer(createContext()); |
| 62 m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); | 62 m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 virtual void didLoseContextOnImplThread() OVERRIDE { } | 65 virtual void didLoseContextOnImplThread() OVERRIDE { } |
| 66 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } | 66 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } |
| 67 virtual void onVSyncParametersChanged(double, double) OVERRIDE { } | 67 virtual void onVSyncParametersChanged(double, double) OVERRIDE { } |
| 68 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawState
ChangedCalled = true; } | 68 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawState
ChangedCalled = true; } |
| 69 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = tr
ue; } | 69 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = tr
ue; } |
| 70 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = tr
ue; } | 70 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = tr
ue; } |
| 71 virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimat
ionEventsVector>, double wallClockTime) OVERRIDE { } | 71 virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimat
ionEventsVector>, double wallClockTime) OVERRIDE { } |
| 72 virtual void releaseContentsTexturesOnImplThread() OVERRIDE { } | 72 virtual void releaseContentsTexturesOnImplThread() OVERRIDE { } |
| 73 | 73 |
| 74 PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHost(bool partialSwap, PassOw
nPtr<CCGraphicsContext> graphicsContext, PassOwnPtr<CCLayerImpl> rootPtr) | 74 PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHost(bool partialSwap, PassOw
nPtr<CCGraphicsContext> graphicsContext, PassOwnPtr<CCLayerImpl> rootPtr) |
| 75 { | 75 { |
| 76 CCSettings::setPartialSwapEnabled(partialSwap); | 76 CCSettings::setPartialSwapEnabled(partialSwap); |
| 77 | 77 |
| 78 CCLayerTreeSettings settings; | 78 CCLayerTreeSettings settings; |
| 79 settings.minimumOcclusionTrackingSize = IntSize(); | 79 settings.minimumOcclusionTrackingSize = IntSize(); |
| 80 | 80 |
| 81 OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); | 81 OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); |
| 82 | 82 |
| 83 myHostImpl->initializeRenderer(graphicsContext, UnthrottledUploader); | 83 myHostImpl->initializeRenderer(graphicsContext); |
| 84 myHostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); | 84 myHostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); |
| 85 | 85 |
| 86 OwnPtr<CCLayerImpl> root = rootPtr; | 86 OwnPtr<CCLayerImpl> root = rootPtr; |
| 87 | 87 |
| 88 root->setAnchorPoint(FloatPoint(0, 0)); | 88 root->setAnchorPoint(FloatPoint(0, 0)); |
| 89 root->setPosition(FloatPoint(0, 0)); | 89 root->setPosition(FloatPoint(0, 0)); |
| 90 root->setBounds(IntSize(10, 10)); | 90 root->setBounds(IntSize(10, 10)); |
| 91 root->setContentBounds(IntSize(10, 10)); | 91 root->setContentBounds(IntSize(10, 10)); |
| 92 root->setVisibleContentRect(IntRect(0, 0, 10, 10)); | 92 root->setVisibleContentRect(IntRect(0, 0, 10, 10)); |
| 93 root->setDrawsContent(true); | 93 root->setDrawsContent(true); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 layer->setScrollable(true); | 144 layer->setScrollable(true); |
| 145 layer->setDrawsContent(true); | 145 layer->setDrawsContent(true); |
| 146 layer->setBounds(size); | 146 layer->setBounds(size); |
| 147 layer->setContentBounds(size); | 147 layer->setContentBounds(size); |
| 148 layer->setMaxScrollPosition(IntSize(size.width() * 2, size.height() * 2)
); | 148 layer->setMaxScrollPosition(IntSize(size.width() * 2, size.height() * 2)
); |
| 149 return layer.release(); | 149 return layer.release(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void initializeRendererAndDrawFrame() | 152 void initializeRendererAndDrawFrame() |
| 153 { | 153 { |
| 154 m_hostImpl->initializeRenderer(createContext(), UnthrottledUploader); | 154 m_hostImpl->initializeRenderer(createContext()); |
| 155 CCLayerTreeHostImpl::FrameData frame; | 155 CCLayerTreeHostImpl::FrameData frame; |
| 156 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); | 156 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
| 157 m_hostImpl->drawLayers(frame); | 157 m_hostImpl->drawLayers(frame); |
| 158 m_hostImpl->didDrawAllLayers(frame); | 158 m_hostImpl->didDrawAllLayers(frame); |
| 159 } | 159 } |
| 160 | 160 |
| 161 protected: | 161 protected: |
| 162 PassOwnPtr<CCGraphicsContext> createContext() | 162 PassOwnPtr<CCGraphicsContext> createContext() |
| 163 { | 163 { |
| 164 return FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphi
csContext3D)); | 164 return FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphi
csContext3D)); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 // We should not crash when trying to scroll an empty layer tree. | 311 // We should not crash when trying to scroll an empty layer tree. |
| 312 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Whee
l), CCInputHandlerClient::ScrollIgnored); | 312 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Whee
l), CCInputHandlerClient::ScrollIgnored); |
| 313 } | 313 } |
| 314 | 314 |
| 315 TEST_F(CCLayerTreeHostImplTest, scrollWithoutRenderer) | 315 TEST_F(CCLayerTreeHostImplTest, scrollWithoutRenderer) |
| 316 { | 316 { |
| 317 CCLayerTreeSettings settings; | 317 CCLayerTreeSettings settings; |
| 318 m_hostImpl = CCLayerTreeHostImpl::create(settings, this); | 318 m_hostImpl = CCLayerTreeHostImpl::create(settings, this); |
| 319 | 319 |
| 320 // Initialization will fail here. | 320 // Initialization will fail here. |
| 321 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new FakeWebGraphicsContext3DMakeCurrentFails)), UnthrottledUploader); | 321 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new FakeWebGraphicsContext3DMakeCurrentFails))); |
| 322 m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); | 322 m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); |
| 323 | 323 |
| 324 setupScrollAndContentsLayers(IntSize(100, 100)); | 324 setupScrollAndContentsLayers(IntSize(100, 100)); |
| 325 | 325 |
| 326 // We should not crash when trying to scroll after the renderer initializati
on fails. | 326 // We should not crash when trying to scroll after the renderer initializati
on fails. |
| 327 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Whee
l), CCInputHandlerClient::ScrollIgnored); | 327 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Whee
l), CCInputHandlerClient::ScrollIgnored); |
| 328 } | 328 } |
| 329 | 329 |
| 330 TEST_F(CCLayerTreeHostImplTest, replaceTreeWhileScrolling) | 330 TEST_F(CCLayerTreeHostImplTest, replaceTreeWhileScrolling) |
| 331 { | 331 { |
| (...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1667 layer1->setExpectation(false, false); | 1667 layer1->setExpectation(false, false); |
| 1668 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); | 1668 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
| 1669 m_hostImpl->drawLayers(frame); | 1669 m_hostImpl->drawLayers(frame); |
| 1670 EXPECT_TRUE(layer1->quadsAppended()); | 1670 EXPECT_TRUE(layer1->quadsAppended()); |
| 1671 m_hostImpl->didDrawAllLayers(frame); | 1671 m_hostImpl->didDrawAllLayers(frame); |
| 1672 | 1672 |
| 1673 } | 1673 } |
| 1674 | 1674 |
| 1675 TEST_F(CCLayerTreeHostImplTest, viewportCovered) | 1675 TEST_F(CCLayerTreeHostImplTest, viewportCovered) |
| 1676 { | 1676 { |
| 1677 m_hostImpl->initializeRenderer(createContext(), UnthrottledUploader); | 1677 m_hostImpl->initializeRenderer(createContext()); |
| 1678 m_hostImpl->setBackgroundColor(SK_ColorGRAY); | 1678 m_hostImpl->setBackgroundColor(SK_ColorGRAY); |
| 1679 | 1679 |
| 1680 IntSize viewportSize(1000, 1000); | 1680 IntSize viewportSize(1000, 1000); |
| 1681 m_hostImpl->setViewportSize(viewportSize, viewportSize); | 1681 m_hostImpl->setViewportSize(viewportSize, viewportSize); |
| 1682 | 1682 |
| 1683 m_hostImpl->setRootLayer(BlendStateCheckLayer::create(1, m_hostImpl->resourc
eProvider())); | 1683 m_hostImpl->setRootLayer(BlendStateCheckLayer::create(1, m_hostImpl->resourc
eProvider())); |
| 1684 BlendStateCheckLayer* root = static_cast<BlendStateCheckLayer*>(m_hostImpl->
rootLayer()); | 1684 BlendStateCheckLayer* root = static_cast<BlendStateCheckLayer*>(m_hostImpl->
rootLayer()); |
| 1685 root->setExpectation(false, true); | 1685 root->setExpectation(false, true); |
| 1686 root->setOpaque(true); | 1686 root->setOpaque(true); |
| 1687 | 1687 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1778 explicit FakeDrawableCCLayerImpl(int id) : CCLayerImpl(id) { } | 1778 explicit FakeDrawableCCLayerImpl(int id) : CCLayerImpl(id) { } |
| 1779 }; | 1779 }; |
| 1780 | 1780 |
| 1781 // Only reshape when we know we are going to draw. Otherwise, the reshape | 1781 // Only reshape when we know we are going to draw. Otherwise, the reshape |
| 1782 // can leave the window at the wrong size if we never draw and the proper | 1782 // can leave the window at the wrong size if we never draw and the proper |
| 1783 // viewport size is never set. | 1783 // viewport size is never set. |
| 1784 TEST_F(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw) | 1784 TEST_F(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw) |
| 1785 { | 1785 { |
| 1786 OwnPtr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create
(adoptPtr(new ReshapeTrackerContext)); | 1786 OwnPtr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create
(adoptPtr(new ReshapeTrackerContext)); |
| 1787 ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(
ccContext->context3D()); | 1787 ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(
ccContext->context3D()); |
| 1788 m_hostImpl->initializeRenderer(ccContext.release(), UnthrottledUploader); | 1788 m_hostImpl->initializeRenderer(ccContext.release()); |
| 1789 | 1789 |
| 1790 CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); | 1790 CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); |
| 1791 root->setAnchorPoint(FloatPoint(0, 0)); | 1791 root->setAnchorPoint(FloatPoint(0, 0)); |
| 1792 root->setBounds(IntSize(10, 10)); | 1792 root->setBounds(IntSize(10, 10)); |
| 1793 root->setDrawsContent(true); | 1793 root->setDrawsContent(true); |
| 1794 m_hostImpl->setRootLayer(adoptPtr(root)); | 1794 m_hostImpl->setRootLayer(adoptPtr(root)); |
| 1795 EXPECT_FALSE(reshapeTracker->reshapeCalled()); | 1795 EXPECT_FALSE(reshapeTracker->reshapeCalled()); |
| 1796 | 1796 |
| 1797 CCLayerTreeHostImpl::FrameData frame; | 1797 CCLayerTreeHostImpl::FrameData frame; |
| 1798 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); | 1798 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1827 TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) | 1827 TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) |
| 1828 { | 1828 { |
| 1829 OwnPtr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create
(adoptPtr(new PartialSwapTrackerContext)); | 1829 OwnPtr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create
(adoptPtr(new PartialSwapTrackerContext)); |
| 1830 PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrack
erContext*>(ccContext->context3D()); | 1830 PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrack
erContext*>(ccContext->context3D()); |
| 1831 | 1831 |
| 1832 // This test creates its own CCLayerTreeHostImpl, so | 1832 // This test creates its own CCLayerTreeHostImpl, so |
| 1833 // that we can force partial swap enabled. | 1833 // that we can force partial swap enabled. |
| 1834 CCLayerTreeSettings settings; | 1834 CCLayerTreeSettings settings; |
| 1835 CCSettings::setPartialSwapEnabled(true); | 1835 CCSettings::setPartialSwapEnabled(true); |
| 1836 OwnPtr<CCLayerTreeHostImpl> layerTreeHostImpl = CCLayerTreeHostImpl::create(
settings, this); | 1836 OwnPtr<CCLayerTreeHostImpl> layerTreeHostImpl = CCLayerTreeHostImpl::create(
settings, this); |
| 1837 layerTreeHostImpl->initializeRenderer(ccContext.release(), UnthrottledUpload
er); | 1837 layerTreeHostImpl->initializeRenderer(ccContext.release()); |
| 1838 layerTreeHostImpl->setViewportSize(IntSize(500, 500), IntSize(500, 500)); | 1838 layerTreeHostImpl->setViewportSize(IntSize(500, 500), IntSize(500, 500)); |
| 1839 | 1839 |
| 1840 CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); | 1840 CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); |
| 1841 CCLayerImpl* child = new FakeDrawableCCLayerImpl(2); | 1841 CCLayerImpl* child = new FakeDrawableCCLayerImpl(2); |
| 1842 child->setPosition(FloatPoint(12, 13)); | 1842 child->setPosition(FloatPoint(12, 13)); |
| 1843 child->setAnchorPoint(FloatPoint(0, 0)); | 1843 child->setAnchorPoint(FloatPoint(0, 0)); |
| 1844 child->setBounds(IntSize(14, 15)); | 1844 child->setBounds(IntSize(14, 15)); |
| 1845 child->setContentBounds(IntSize(14, 15)); | 1845 child->setContentBounds(IntSize(14, 15)); |
| 1846 child->setDrawsContent(true); | 1846 child->setDrawsContent(true); |
| 1847 root->setAnchorPoint(FloatPoint(0, 0)); | 1847 root->setAnchorPoint(FloatPoint(0, 0)); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2114 }; | 2114 }; |
| 2115 | 2115 |
| 2116 static PassOwnPtr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C
CLayerTreeHostImplClient* client) | 2116 static PassOwnPtr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C
CLayerTreeHostImplClient* client) |
| 2117 { | 2117 { |
| 2118 CCSettings::setPartialSwapEnabled(partialSwap); | 2118 CCSettings::setPartialSwapEnabled(partialSwap); |
| 2119 | 2119 |
| 2120 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 2120 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
| 2121 | 2121 |
| 2122 CCLayerTreeSettings settings; | 2122 CCLayerTreeSettings settings; |
| 2123 OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(setting
s, client); | 2123 OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(setting
s, client); |
| 2124 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); | 2124 myHostImpl->initializeRenderer(context.release()); |
| 2125 myHostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); | 2125 myHostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); |
| 2126 | 2126 |
| 2127 /* | 2127 /* |
| 2128 Layers are created as follows: | 2128 Layers are created as follows: |
| 2129 | 2129 |
| 2130 +--------------------+ | 2130 +--------------------+ |
| 2131 | 1 | | 2131 | 1 | |
| 2132 | +-----------+ | | 2132 | +-----------+ | |
| 2133 | | 2 | | | 2133 | | 2 | | |
| 2134 | | +-------------------+ | 2134 | | +-------------------+ |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2253 root->addChild(ContextLostNotificationCheckLayer::create(1)); | 2253 root->addChild(ContextLostNotificationCheckLayer::create(1)); |
| 2254 ContextLostNotificationCheckLayer* layer1 = static_cast<ContextLostNotificat
ionCheckLayer*>(root->children()[0].get()); | 2254 ContextLostNotificationCheckLayer* layer1 = static_cast<ContextLostNotificat
ionCheckLayer*>(root->children()[0].get()); |
| 2255 | 2255 |
| 2256 layer1->addChild(ContextLostNotificationCheckLayer::create(2)); | 2256 layer1->addChild(ContextLostNotificationCheckLayer::create(2)); |
| 2257 ContextLostNotificationCheckLayer* layer2 = static_cast<ContextLostNotificat
ionCheckLayer*>(layer1->children()[0].get()); | 2257 ContextLostNotificationCheckLayer* layer2 = static_cast<ContextLostNotificat
ionCheckLayer*>(layer1->children()[0].get()); |
| 2258 | 2258 |
| 2259 EXPECT_FALSE(root->didLoseContextCalled()); | 2259 EXPECT_FALSE(root->didLoseContextCalled()); |
| 2260 EXPECT_FALSE(layer1->didLoseContextCalled()); | 2260 EXPECT_FALSE(layer1->didLoseContextCalled()); |
| 2261 EXPECT_FALSE(layer2->didLoseContextCalled()); | 2261 EXPECT_FALSE(layer2->didLoseContextCalled()); |
| 2262 | 2262 |
| 2263 m_hostImpl->initializeRenderer(createContext(), UnthrottledUploader); | 2263 m_hostImpl->initializeRenderer(createContext()); |
| 2264 | 2264 |
| 2265 EXPECT_TRUE(root->didLoseContextCalled()); | 2265 EXPECT_TRUE(root->didLoseContextCalled()); |
| 2266 EXPECT_TRUE(layer1->didLoseContextCalled()); | 2266 EXPECT_TRUE(layer1->didLoseContextCalled()); |
| 2267 EXPECT_TRUE(layer2->didLoseContextCalled()); | 2267 EXPECT_TRUE(layer2->didLoseContextCalled()); |
| 2268 } | 2268 } |
| 2269 | 2269 |
| 2270 TEST_F(CCLayerTreeHostImplTest, finishAllRenderingAfterContextLost) | 2270 TEST_F(CCLayerTreeHostImplTest, finishAllRenderingAfterContextLost) |
| 2271 { | 2271 { |
| 2272 CCLayerTreeSettings settings; | 2272 CCLayerTreeSettings settings; |
| 2273 m_hostImpl = CCLayerTreeHostImpl::create(settings, this); | 2273 m_hostImpl = CCLayerTreeHostImpl::create(settings, this); |
| 2274 | 2274 |
| 2275 // The context initialization will fail, but we should still be able to call
finishAllRendering() without any ill effects. | 2275 // The context initialization will fail, but we should still be able to call
finishAllRendering() without any ill effects. |
| 2276 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new FakeWebGraphicsContext3DMakeCurrentFails)), UnthrottledUploader); | 2276 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new FakeWebGraphicsContext3DMakeCurrentFails))); |
| 2277 m_hostImpl->finishAllRendering(); | 2277 m_hostImpl->finishAllRendering(); |
| 2278 } | 2278 } |
| 2279 | 2279 |
| 2280 // Fake WebGraphicsContext3D that will cause a failure if trying to use a | 2280 // Fake WebGraphicsContext3D that will cause a failure if trying to use a |
| 2281 // resource that wasn't created by it (resources created by | 2281 // resource that wasn't created by it (resources created by |
| 2282 // FakeWebGraphicsContext3D have an id of 1). | 2282 // FakeWebGraphicsContext3D have an id of 1). |
| 2283 class StrictWebGraphicsContext3D : public FakeWebGraphicsContext3D { | 2283 class StrictWebGraphicsContext3D : public FakeWebGraphicsContext3D { |
| 2284 public: | 2284 public: |
| 2285 StrictWebGraphicsContext3D() | 2285 StrictWebGraphicsContext3D() |
| 2286 : FakeWebGraphicsContext3D() | 2286 : FakeWebGraphicsContext3D() |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2548 OwnPtr<FakeScrollbarLayerImpl> scrollbarLayer(FakeScrollbarLayerImpl::create
(8)); | 2548 OwnPtr<FakeScrollbarLayerImpl> scrollbarLayer(FakeScrollbarLayerImpl::create
(8)); |
| 2549 scrollbarLayer->setLayerTreeHostImpl(m_hostImpl.get()); | 2549 scrollbarLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
| 2550 scrollbarLayer->setBounds(IntSize(10, 10)); | 2550 scrollbarLayer->setBounds(IntSize(10, 10)); |
| 2551 scrollbarLayer->setContentBounds(IntSize(10, 10)); | 2551 scrollbarLayer->setContentBounds(IntSize(10, 10)); |
| 2552 scrollbarLayer->setDrawsContent(true); | 2552 scrollbarLayer->setDrawsContent(true); |
| 2553 scrollbarLayer->setLayerTreeHostImpl(m_hostImpl.get()); | 2553 scrollbarLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
| 2554 scrollbarLayer->createResources(m_hostImpl->resourceProvider()); | 2554 scrollbarLayer->createResources(m_hostImpl->resourceProvider()); |
| 2555 rootLayer->addChild(scrollbarLayer.release()); | 2555 rootLayer->addChild(scrollbarLayer.release()); |
| 2556 | 2556 |
| 2557 // Use a context that supports IOSurfaces | 2557 // Use a context that supports IOSurfaces |
| 2558 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new FakeWebGraphicsContext3DWithIOSurface)), UnthrottledUploader); | 2558 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new FakeWebGraphicsContext3DWithIOSurface))); |
| 2559 | 2559 |
| 2560 hwVideoFrame.setTextureId(m_hostImpl->resourceProvider()->graphicsContext3D(
)->createTexture()); | 2560 hwVideoFrame.setTextureId(m_hostImpl->resourceProvider()->graphicsContext3D(
)->createTexture()); |
| 2561 | 2561 |
| 2562 m_hostImpl->setRootLayer(rootLayer.release()); | 2562 m_hostImpl->setRootLayer(rootLayer.release()); |
| 2563 | 2563 |
| 2564 CCLayerTreeHostImpl::FrameData frame; | 2564 CCLayerTreeHostImpl::FrameData frame; |
| 2565 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); | 2565 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
| 2566 m_hostImpl->drawLayers(frame); | 2566 m_hostImpl->drawLayers(frame); |
| 2567 m_hostImpl->didDrawAllLayers(frame); | 2567 m_hostImpl->didDrawAllLayers(frame); |
| 2568 m_hostImpl->swapBuffers(); | 2568 m_hostImpl->swapBuffers(); |
| 2569 | 2569 |
| 2570 unsigned numResources = m_hostImpl->resourceProvider()->numResources(); | 2570 unsigned numResources = m_hostImpl->resourceProvider()->numResources(); |
| 2571 | 2571 |
| 2572 // Lose the context, replacing it with a StrictWebGraphicsContext3DWithIOSur
face, | 2572 // Lose the context, replacing it with a StrictWebGraphicsContext3DWithIOSur
face, |
| 2573 // that will warn if any resource from the previous context gets used. | 2573 // that will warn if any resource from the previous context gets used. |
| 2574 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new StrictWebGraphicsContext3DWithIOSurface)), UnthrottledUploader); | 2574 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new StrictWebGraphicsContext3DWithIOSurface))); |
| 2575 | 2575 |
| 2576 // Create dummy resources so that looking up an old resource will get an | 2576 // Create dummy resources so that looking up an old resource will get an |
| 2577 // invalid texture id mapping. | 2577 // invalid texture id mapping. |
| 2578 for (unsigned i = 0; i < numResources; ++i) | 2578 for (unsigned i = 0; i < numResources; ++i) |
| 2579 m_hostImpl->resourceProvider()->createResourceFromExternalTexture(1); | 2579 m_hostImpl->resourceProvider()->createResourceFromExternalTexture(1); |
| 2580 | 2580 |
| 2581 // The WebVideoFrameProvider is expected to recreate its textures after a | 2581 // The WebVideoFrameProvider is expected to recreate its textures after a |
| 2582 // lost context (or not serve a frame). | 2582 // lost context (or not serve a frame). |
| 2583 hwProvider.setFrame(0); | 2583 hwProvider.setFrame(0); |
| 2584 | 2584 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2677 ioSurfaceLayer->setAnchorPoint(FloatPoint(0, 0)); | 2677 ioSurfaceLayer->setAnchorPoint(FloatPoint(0, 0)); |
| 2678 ioSurfaceLayer->setContentBounds(IntSize(10, 10)); | 2678 ioSurfaceLayer->setContentBounds(IntSize(10, 10)); |
| 2679 ioSurfaceLayer->setDrawsContent(true); | 2679 ioSurfaceLayer->setDrawsContent(true); |
| 2680 ioSurfaceLayer->setIOSurfaceProperties(1, IntSize(10, 10)); | 2680 ioSurfaceLayer->setIOSurfaceProperties(1, IntSize(10, 10)); |
| 2681 ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get()); | 2681 ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
| 2682 rootLayer->addChild(ioSurfaceLayer.release()); | 2682 rootLayer->addChild(ioSurfaceLayer.release()); |
| 2683 | 2683 |
| 2684 // Lose the context, replacing it with a TrackingWebGraphicsContext3D (which
the CCLayerTreeHostImpl takes ownership of). | 2684 // Lose the context, replacing it with a TrackingWebGraphicsContext3D (which
the CCLayerTreeHostImpl takes ownership of). |
| 2685 OwnPtr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(a
doptPtr(new TrackingWebGraphicsContext3D))); | 2685 OwnPtr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(a
doptPtr(new TrackingWebGraphicsContext3D))); |
| 2686 TrackingWebGraphicsContext3D* trackingWebGraphicsContext = static_cast<Track
ingWebGraphicsContext3D*>(ccContext->context3D()); | 2686 TrackingWebGraphicsContext3D* trackingWebGraphicsContext = static_cast<Track
ingWebGraphicsContext3D*>(ccContext->context3D()); |
| 2687 m_hostImpl->initializeRenderer(ccContext.release(), UnthrottledUploader); | 2687 m_hostImpl->initializeRenderer(ccContext.release()); |
| 2688 | 2688 |
| 2689 m_hostImpl->setRootLayer(rootLayer.release()); | 2689 m_hostImpl->setRootLayer(rootLayer.release()); |
| 2690 | 2690 |
| 2691 CCLayerTreeHostImpl::FrameData frame; | 2691 CCLayerTreeHostImpl::FrameData frame; |
| 2692 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); | 2692 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
| 2693 m_hostImpl->drawLayers(frame); | 2693 m_hostImpl->drawLayers(frame); |
| 2694 m_hostImpl->didDrawAllLayers(frame); | 2694 m_hostImpl->didDrawAllLayers(frame); |
| 2695 m_hostImpl->swapBuffers(); | 2695 m_hostImpl->swapBuffers(); |
| 2696 | 2696 |
| 2697 EXPECT_GT(trackingWebGraphicsContext->numTextures(), 0u); | 2697 EXPECT_GT(trackingWebGraphicsContext->numTextures(), 0u); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2749 layerPtr->setOpaque(true); | 2749 layerPtr->setOpaque(true); |
| 2750 parent->addChild(layer.release()); | 2750 parent->addChild(layer.release()); |
| 2751 if (result) | 2751 if (result) |
| 2752 *result = layerPtr; | 2752 *result = layerPtr; |
| 2753 } | 2753 } |
| 2754 | 2754 |
| 2755 static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl,
CCLayerImpl*& rootPtr, CCLayerImpl*& intermediateLayerPtr, CCLayerImpl*& surfac
eLayerPtr, CCLayerImpl*& childPtr, const IntSize& rootSize) | 2755 static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl,
CCLayerImpl*& rootPtr, CCLayerImpl*& intermediateLayerPtr, CCLayerImpl*& surfac
eLayerPtr, CCLayerImpl*& childPtr, const IntSize& rootSize) |
| 2756 { | 2756 { |
| 2757 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 2757 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
| 2758 | 2758 |
| 2759 layerTreeHostImpl->initializeRenderer(context.release(), UnthrottledUploader
); | 2759 layerTreeHostImpl->initializeRenderer(context.release()); |
| 2760 layerTreeHostImpl->setViewportSize(rootSize, rootSize); | 2760 layerTreeHostImpl->setViewportSize(rootSize, rootSize); |
| 2761 | 2761 |
| 2762 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 2762 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
| 2763 rootPtr = root.get(); | 2763 rootPtr = root.get(); |
| 2764 | 2764 |
| 2765 root->setAnchorPoint(FloatPoint(0, 0)); | 2765 root->setAnchorPoint(FloatPoint(0, 0)); |
| 2766 root->setPosition(FloatPoint(0, 0)); | 2766 root->setPosition(FloatPoint(0, 0)); |
| 2767 root->setBounds(rootSize); | 2767 root->setBounds(rootSize); |
| 2768 root->setContentBounds(rootSize); | 2768 root->setContentBounds(rootSize); |
| 2769 root->setDrawsContent(true); | 2769 root->setDrawsContent(true); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2795 settings.minimumOcclusionTrackingSize = IntSize(); | 2795 settings.minimumOcclusionTrackingSize = IntSize(); |
| 2796 OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(setting
s, this); | 2796 OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(setting
s, this); |
| 2797 | 2797 |
| 2798 CCLayerImpl* rootPtr; | 2798 CCLayerImpl* rootPtr; |
| 2799 CCLayerImpl* surfaceLayerPtr; | 2799 CCLayerImpl* surfaceLayerPtr; |
| 2800 | 2800 |
| 2801 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 2801 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
| 2802 | 2802 |
| 2803 IntSize rootSize(100, 100); | 2803 IntSize rootSize(100, 100); |
| 2804 | 2804 |
| 2805 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); | 2805 myHostImpl->initializeRenderer(context.release()); |
| 2806 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); | 2806 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); |
| 2807 | 2807 |
| 2808 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 2808 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
| 2809 rootPtr = root.get(); | 2809 rootPtr = root.get(); |
| 2810 | 2810 |
| 2811 root->setAnchorPoint(FloatPoint(0, 0)); | 2811 root->setAnchorPoint(FloatPoint(0, 0)); |
| 2812 root->setPosition(FloatPoint(0, 0)); | 2812 root->setPosition(FloatPoint(0, 0)); |
| 2813 root->setBounds(rootSize); | 2813 root->setBounds(rootSize); |
| 2814 root->setContentBounds(rootSize); | 2814 root->setContentBounds(rootSize); |
| 2815 root->setDrawsContent(true); | 2815 root->setDrawsContent(true); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2907 // L21 occludes L20 (internal) | 2907 // L21 occludes L20 (internal) |
| 2908 | 2908 |
| 2909 CCLayerImpl* rootPtr; | 2909 CCLayerImpl* rootPtr; |
| 2910 CCLayerImpl* layerS1Ptr; | 2910 CCLayerImpl* layerS1Ptr; |
| 2911 CCLayerImpl* layerS2Ptr; | 2911 CCLayerImpl* layerS2Ptr; |
| 2912 | 2912 |
| 2913 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 2913 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
| 2914 | 2914 |
| 2915 IntSize rootSize(1000, 1000); | 2915 IntSize rootSize(1000, 1000); |
| 2916 | 2916 |
| 2917 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); | 2917 myHostImpl->initializeRenderer(context.release()); |
| 2918 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); | 2918 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); |
| 2919 | 2919 |
| 2920 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 2920 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
| 2921 rootPtr = root.get(); | 2921 rootPtr = root.get(); |
| 2922 | 2922 |
| 2923 root->setAnchorPoint(FloatPoint(0, 0)); | 2923 root->setAnchorPoint(FloatPoint(0, 0)); |
| 2924 root->setPosition(FloatPoint(0, 0)); | 2924 root->setPosition(FloatPoint(0, 0)); |
| 2925 root->setBounds(rootSize); | 2925 root->setBounds(rootSize); |
| 2926 root->setContentBounds(rootSize); | 2926 root->setContentBounds(rootSize); |
| 2927 root->setDrawsContent(true); | 2927 root->setDrawsContent(true); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3020 // | 3020 // |
| 3021 | 3021 |
| 3022 CCLayerImpl* rootPtr; | 3022 CCLayerImpl* rootPtr; |
| 3023 CCLayerImpl* layerS1Ptr; | 3023 CCLayerImpl* layerS1Ptr; |
| 3024 CCLayerImpl* layerS2Ptr; | 3024 CCLayerImpl* layerS2Ptr; |
| 3025 | 3025 |
| 3026 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 3026 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
| 3027 | 3027 |
| 3028 IntSize rootSize(1000, 1000); | 3028 IntSize rootSize(1000, 1000); |
| 3029 | 3029 |
| 3030 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); | 3030 myHostImpl->initializeRenderer(context.release()); |
| 3031 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); | 3031 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); |
| 3032 | 3032 |
| 3033 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 3033 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
| 3034 rootPtr = root.get(); | 3034 rootPtr = root.get(); |
| 3035 | 3035 |
| 3036 root->setAnchorPoint(FloatPoint(0, 0)); | 3036 root->setAnchorPoint(FloatPoint(0, 0)); |
| 3037 root->setPosition(FloatPoint(0, 0)); | 3037 root->setPosition(FloatPoint(0, 0)); |
| 3038 root->setBounds(rootSize); | 3038 root->setBounds(rootSize); |
| 3039 root->setContentBounds(rootSize); | 3039 root->setContentBounds(rootSize); |
| 3040 root->setDrawsContent(true); | 3040 root->setDrawsContent(true); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3134 // | 3134 // |
| 3135 | 3135 |
| 3136 CCLayerImpl* rootPtr; | 3136 CCLayerImpl* rootPtr; |
| 3137 CCLayerImpl* layerS1Ptr; | 3137 CCLayerImpl* layerS1Ptr; |
| 3138 CCLayerImpl* layerS2Ptr; | 3138 CCLayerImpl* layerS2Ptr; |
| 3139 | 3139 |
| 3140 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 3140 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
| 3141 | 3141 |
| 3142 IntSize rootSize(1000, 1000); | 3142 IntSize rootSize(1000, 1000); |
| 3143 | 3143 |
| 3144 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); | 3144 myHostImpl->initializeRenderer(context.release()); |
| 3145 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); | 3145 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); |
| 3146 | 3146 |
| 3147 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 3147 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
| 3148 rootPtr = root.get(); | 3148 rootPtr = root.get(); |
| 3149 | 3149 |
| 3150 root->setAnchorPoint(FloatPoint(0, 0)); | 3150 root->setAnchorPoint(FloatPoint(0, 0)); |
| 3151 root->setPosition(FloatPoint(0, 0)); | 3151 root->setPosition(FloatPoint(0, 0)); |
| 3152 root->setBounds(rootSize); | 3152 root->setBounds(rootSize); |
| 3153 root->setContentBounds(rootSize); | 3153 root->setContentBounds(rootSize); |
| 3154 root->setDrawsContent(true); | 3154 root->setDrawsContent(true); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3217 // R +-- S1 +- L10 (rotated, drawing) | 3217 // R +-- S1 +- L10 (rotated, drawing) |
| 3218 // +- L11 (occupies half surface) | 3218 // +- L11 (occupies half surface) |
| 3219 | 3219 |
| 3220 CCLayerImpl* rootPtr; | 3220 CCLayerImpl* rootPtr; |
| 3221 CCLayerImpl* layerS1Ptr; | 3221 CCLayerImpl* layerS1Ptr; |
| 3222 | 3222 |
| 3223 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 3223 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
| 3224 | 3224 |
| 3225 IntSize rootSize(1000, 1000); | 3225 IntSize rootSize(1000, 1000); |
| 3226 | 3226 |
| 3227 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); | 3227 myHostImpl->initializeRenderer(context.release()); |
| 3228 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); | 3228 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); |
| 3229 | 3229 |
| 3230 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 3230 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
| 3231 rootPtr = root.get(); | 3231 rootPtr = root.get(); |
| 3232 | 3232 |
| 3233 root->setAnchorPoint(FloatPoint(0, 0)); | 3233 root->setAnchorPoint(FloatPoint(0, 0)); |
| 3234 root->setPosition(FloatPoint(0, 0)); | 3234 root->setPosition(FloatPoint(0, 0)); |
| 3235 root->setBounds(rootSize); | 3235 root->setBounds(rootSize); |
| 3236 root->setContentBounds(rootSize); | 3236 root->setContentBounds(rootSize); |
| 3237 root->setDrawsContent(true); | 3237 root->setDrawsContent(true); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3302 // L21 occludes L20 (internal) | 3302 // L21 occludes L20 (internal) |
| 3303 | 3303 |
| 3304 CCLayerImpl* rootPtr; | 3304 CCLayerImpl* rootPtr; |
| 3305 CCLayerImpl* layerS1Ptr; | 3305 CCLayerImpl* layerS1Ptr; |
| 3306 CCLayerImpl* layerS2Ptr; | 3306 CCLayerImpl* layerS2Ptr; |
| 3307 | 3307 |
| 3308 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 3308 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
| 3309 | 3309 |
| 3310 IntSize rootSize(1000, 1000); | 3310 IntSize rootSize(1000, 1000); |
| 3311 | 3311 |
| 3312 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); | 3312 myHostImpl->initializeRenderer(context.release()); |
| 3313 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); | 3313 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); |
| 3314 | 3314 |
| 3315 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 3315 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
| 3316 rootPtr = root.get(); | 3316 rootPtr = root.get(); |
| 3317 | 3317 |
| 3318 root->setAnchorPoint(FloatPoint(0, 0)); | 3318 root->setAnchorPoint(FloatPoint(0, 0)); |
| 3319 root->setPosition(FloatPoint(0, 0)); | 3319 root->setPosition(FloatPoint(0, 0)); |
| 3320 root->setBounds(rootSize); | 3320 root->setBounds(rootSize); |
| 3321 root->setContentBounds(rootSize); | 3321 root->setContentBounds(rootSize); |
| 3322 root->setDrawsContent(true); | 3322 root->setDrawsContent(true); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3420 */ | 3420 */ |
| 3421 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 3421 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
| 3422 OwnPtr<CCTiledLayerImpl> child = CCTiledLayerImpl::create(2); | 3422 OwnPtr<CCTiledLayerImpl> child = CCTiledLayerImpl::create(2); |
| 3423 OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(3); | 3423 OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(3); |
| 3424 | 3424 |
| 3425 IntRect rootRect(0, 0, 100, 100); | 3425 IntRect rootRect(0, 0, 100, 100); |
| 3426 IntRect childRect(10, 10, 50, 50); | 3426 IntRect childRect(10, 10, 50, 50); |
| 3427 IntRect grandChildRect(5, 5, 150, 150); | 3427 IntRect grandChildRect(5, 5, 150, 150); |
| 3428 | 3428 |
| 3429 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 3429 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
| 3430 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); | 3430 myHostImpl->initializeRenderer(context.release()); |
| 3431 | 3431 |
| 3432 root->setAnchorPoint(FloatPoint(0, 0)); | 3432 root->setAnchorPoint(FloatPoint(0, 0)); |
| 3433 root->setPosition(FloatPoint(rootRect.x(), rootRect.y())); | 3433 root->setPosition(FloatPoint(rootRect.x(), rootRect.y())); |
| 3434 root->setBounds(IntSize(rootRect.width(), rootRect.height())); | 3434 root->setBounds(IntSize(rootRect.width(), rootRect.height())); |
| 3435 root->setContentBounds(root->bounds()); | 3435 root->setContentBounds(root->bounds()); |
| 3436 root->setDrawsContent(true); | 3436 root->setDrawsContent(true); |
| 3437 root->setMasksToBounds(true); | 3437 root->setMasksToBounds(true); |
| 3438 | 3438 |
| 3439 child->setAnchorPoint(FloatPoint(0, 0)); | 3439 child->setAnchorPoint(FloatPoint(0, 0)); |
| 3440 child->setPosition(FloatPoint(childRect.x(), childRect.y())); | 3440 child->setPosition(FloatPoint(childRect.x(), childRect.y())); |
| (...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4177 { | 4177 { |
| 4178 char actualResult[1024]; | 4178 char actualResult[1024]; |
| 4179 dumpRenderPassTestData(testData, actualResult); | 4179 dumpRenderPassTestData(testData, actualResult); |
| 4180 EXPECT_STREQ(testCase.expectedResult, actualResult) << "In test case: " << t
estCase.name; | 4180 EXPECT_STREQ(testCase.expectedResult, actualResult) << "In test case: " << t
estCase.name; |
| 4181 } | 4181 } |
| 4182 | 4182 |
| 4183 TEST_F(CCLayerTreeHostImplTest, testRemoveRenderPasses) | 4183 TEST_F(CCLayerTreeHostImplTest, testRemoveRenderPasses) |
| 4184 { | 4184 { |
| 4185 OwnPtr<CCGraphicsContext> context(createContext()); | 4185 OwnPtr<CCGraphicsContext> context(createContext()); |
| 4186 ASSERT_TRUE(context->context3D()); | 4186 ASSERT_TRUE(context->context3D()); |
| 4187 OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(conte
xt.get(), UnthrottledUploader)); | 4187 OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(conte
xt.get())); |
| 4188 | 4188 |
| 4189 OwnPtr<CCTestRenderer> renderer(CCTestRenderer::create(resourceProvider.get(
))); | 4189 OwnPtr<CCTestRenderer> renderer(CCTestRenderer::create(resourceProvider.get(
))); |
| 4190 | 4190 |
| 4191 int testCaseIndex = 0; | 4191 int testCaseIndex = 0; |
| 4192 while (removeRenderPassesCases[testCaseIndex].name) { | 4192 while (removeRenderPassesCases[testCaseIndex].name) { |
| 4193 RenderPassRemovalTestData testData; | 4193 RenderPassRemovalTestData testData; |
| 4194 configureRenderPassTestData(removeRenderPassesCases[testCaseIndex].initS
cript, testData, renderer.get()); | 4194 configureRenderPassTestData(removeRenderPassesCases[testCaseIndex].initS
cript, testData, renderer.get()); |
| 4195 CCLayerTreeHostImpl::removeRenderPasses(CCLayerTreeHostImpl::CullRenderP
assesWithCachedTextures(*renderer), testData); | 4195 CCLayerTreeHostImpl::removeRenderPasses(CCLayerTreeHostImpl::CullRenderP
assesWithCachedTextures(*renderer), testData); |
| 4196 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat
a); | 4196 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat
a); |
| 4197 testCaseIndex++; | 4197 testCaseIndex++; |
| 4198 } | 4198 } |
| 4199 } | 4199 } |
| 4200 | 4200 |
| 4201 } // namespace | 4201 } // namespace |
| OLD | NEW |