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 "CCDelegatedRendererLayerImpl.h" | 10 #include "CCDelegatedRendererLayerImpl.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 public: | 54 public: |
55 CCLayerTreeHostImplTest() | 55 CCLayerTreeHostImplTest() |
56 : m_onCanDrawStateChangedCalled(false) | 56 : m_onCanDrawStateChangedCalled(false) |
57 , m_didRequestCommit(false) | 57 , m_didRequestCommit(false) |
58 , m_didRequestRedraw(false) | 58 , m_didRequestRedraw(false) |
59 { | 59 { |
60 CCLayerTreeSettings settings; | 60 CCLayerTreeSettings settings; |
61 settings.minimumOcclusionTrackingSize = IntSize(); | 61 settings.minimumOcclusionTrackingSize = IntSize(); |
62 | 62 |
63 m_hostImpl = CCLayerTreeHostImpl::create(settings, this); | 63 m_hostImpl = CCLayerTreeHostImpl::create(settings, this); |
64 m_hostImpl->initializeRenderer(createContext(), UnthrottledUploader); | 64 m_hostImpl->initializeRenderer(createContext()); |
65 m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); | 65 m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); |
66 } | 66 } |
67 | 67 |
68 virtual void didLoseContextOnImplThread() OVERRIDE { } | 68 virtual void didLoseContextOnImplThread() OVERRIDE { } |
69 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } | 69 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } |
70 virtual void onVSyncParametersChanged(double, double) OVERRIDE { } | 70 virtual void onVSyncParametersChanged(double, double) OVERRIDE { } |
71 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawState
ChangedCalled = true; } | 71 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawState
ChangedCalled = true; } |
72 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = tr
ue; } | 72 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = tr
ue; } |
73 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = tr
ue; } | 73 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = tr
ue; } |
74 virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimat
ionEventsVector>, double wallClockTime) OVERRIDE { } | 74 virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimat
ionEventsVector>, double wallClockTime) OVERRIDE { } |
75 virtual void releaseContentsTexturesOnImplThread() OVERRIDE { } | 75 virtual void releaseContentsTexturesOnImplThread() OVERRIDE { } |
76 | 76 |
77 PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHost(bool partialSwap, PassOw
nPtr<CCGraphicsContext> graphicsContext, PassOwnPtr<CCLayerImpl> rootPtr) | 77 PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHost(bool partialSwap, PassOw
nPtr<CCGraphicsContext> graphicsContext, PassOwnPtr<CCLayerImpl> rootPtr) |
78 { | 78 { |
79 CCSettings::setPartialSwapEnabled(partialSwap); | 79 CCSettings::setPartialSwapEnabled(partialSwap); |
80 | 80 |
81 CCLayerTreeSettings settings; | 81 CCLayerTreeSettings settings; |
82 settings.minimumOcclusionTrackingSize = IntSize(); | 82 settings.minimumOcclusionTrackingSize = IntSize(); |
83 | 83 |
84 OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); | 84 OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); |
85 | 85 |
86 myHostImpl->initializeRenderer(graphicsContext, UnthrottledUploader); | 86 myHostImpl->initializeRenderer(graphicsContext); |
87 myHostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); | 87 myHostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); |
88 | 88 |
89 OwnPtr<CCLayerImpl> root = rootPtr; | 89 OwnPtr<CCLayerImpl> root = rootPtr; |
90 | 90 |
91 root->setAnchorPoint(FloatPoint(0, 0)); | 91 root->setAnchorPoint(FloatPoint(0, 0)); |
92 root->setPosition(FloatPoint(0, 0)); | 92 root->setPosition(FloatPoint(0, 0)); |
93 root->setBounds(IntSize(10, 10)); | 93 root->setBounds(IntSize(10, 10)); |
94 root->setContentBounds(IntSize(10, 10)); | 94 root->setContentBounds(IntSize(10, 10)); |
95 root->setVisibleContentRect(IntRect(0, 0, 10, 10)); | 95 root->setVisibleContentRect(IntRect(0, 0, 10, 10)); |
96 root->setDrawsContent(true); | 96 root->setDrawsContent(true); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 layer->setScrollable(true); | 147 layer->setScrollable(true); |
148 layer->setDrawsContent(true); | 148 layer->setDrawsContent(true); |
149 layer->setBounds(size); | 149 layer->setBounds(size); |
150 layer->setContentBounds(size); | 150 layer->setContentBounds(size); |
151 layer->setMaxScrollPosition(IntSize(size.width() * 2, size.height() * 2)
); | 151 layer->setMaxScrollPosition(IntSize(size.width() * 2, size.height() * 2)
); |
152 return layer.release(); | 152 return layer.release(); |
153 } | 153 } |
154 | 154 |
155 void initializeRendererAndDrawFrame() | 155 void initializeRendererAndDrawFrame() |
156 { | 156 { |
157 m_hostImpl->initializeRenderer(createContext(), UnthrottledUploader); | 157 m_hostImpl->initializeRenderer(createContext()); |
158 CCLayerTreeHostImpl::FrameData frame; | 158 CCLayerTreeHostImpl::FrameData frame; |
159 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); | 159 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
160 m_hostImpl->drawLayers(frame); | 160 m_hostImpl->drawLayers(frame); |
161 m_hostImpl->didDrawAllLayers(frame); | 161 m_hostImpl->didDrawAllLayers(frame); |
162 } | 162 } |
163 | 163 |
164 protected: | 164 protected: |
165 PassOwnPtr<CCGraphicsContext> createContext() | 165 PassOwnPtr<CCGraphicsContext> createContext() |
166 { | 166 { |
167 return FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphi
csContext3D)); | 167 return FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphi
csContext3D)); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 // We should not crash when trying to scroll an empty layer tree. | 314 // We should not crash when trying to scroll an empty layer tree. |
315 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Whee
l), CCInputHandlerClient::ScrollIgnored); | 315 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Whee
l), CCInputHandlerClient::ScrollIgnored); |
316 } | 316 } |
317 | 317 |
318 TEST_F(CCLayerTreeHostImplTest, scrollWithoutRenderer) | 318 TEST_F(CCLayerTreeHostImplTest, scrollWithoutRenderer) |
319 { | 319 { |
320 CCLayerTreeSettings settings; | 320 CCLayerTreeSettings settings; |
321 m_hostImpl = CCLayerTreeHostImpl::create(settings, this); | 321 m_hostImpl = CCLayerTreeHostImpl::create(settings, this); |
322 | 322 |
323 // Initialization will fail here. | 323 // Initialization will fail here. |
324 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new FakeWebGraphicsContext3DMakeCurrentFails)), UnthrottledUploader); | 324 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new FakeWebGraphicsContext3DMakeCurrentFails))); |
325 m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); | 325 m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); |
326 | 326 |
327 setupScrollAndContentsLayers(IntSize(100, 100)); | 327 setupScrollAndContentsLayers(IntSize(100, 100)); |
328 | 328 |
329 // We should not crash when trying to scroll after the renderer initializati
on fails. | 329 // We should not crash when trying to scroll after the renderer initializati
on fails. |
330 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Whee
l), CCInputHandlerClient::ScrollIgnored); | 330 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Whee
l), CCInputHandlerClient::ScrollIgnored); |
331 } | 331 } |
332 | 332 |
333 TEST_F(CCLayerTreeHostImplTest, replaceTreeWhileScrolling) | 333 TEST_F(CCLayerTreeHostImplTest, replaceTreeWhileScrolling) |
334 { | 334 { |
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1670 layer1->setExpectation(false, false); | 1670 layer1->setExpectation(false, false); |
1671 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); | 1671 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
1672 m_hostImpl->drawLayers(frame); | 1672 m_hostImpl->drawLayers(frame); |
1673 EXPECT_TRUE(layer1->quadsAppended()); | 1673 EXPECT_TRUE(layer1->quadsAppended()); |
1674 m_hostImpl->didDrawAllLayers(frame); | 1674 m_hostImpl->didDrawAllLayers(frame); |
1675 | 1675 |
1676 } | 1676 } |
1677 | 1677 |
1678 TEST_F(CCLayerTreeHostImplTest, viewportCovered) | 1678 TEST_F(CCLayerTreeHostImplTest, viewportCovered) |
1679 { | 1679 { |
1680 m_hostImpl->initializeRenderer(createContext(), UnthrottledUploader); | 1680 m_hostImpl->initializeRenderer(createContext()); |
1681 m_hostImpl->setBackgroundColor(SK_ColorGRAY); | 1681 m_hostImpl->setBackgroundColor(SK_ColorGRAY); |
1682 | 1682 |
1683 IntSize viewportSize(1000, 1000); | 1683 IntSize viewportSize(1000, 1000); |
1684 m_hostImpl->setViewportSize(viewportSize, viewportSize); | 1684 m_hostImpl->setViewportSize(viewportSize, viewportSize); |
1685 | 1685 |
1686 m_hostImpl->setRootLayer(BlendStateCheckLayer::create(1, m_hostImpl->resourc
eProvider())); | 1686 m_hostImpl->setRootLayer(BlendStateCheckLayer::create(1, m_hostImpl->resourc
eProvider())); |
1687 BlendStateCheckLayer* root = static_cast<BlendStateCheckLayer*>(m_hostImpl->
rootLayer()); | 1687 BlendStateCheckLayer* root = static_cast<BlendStateCheckLayer*>(m_hostImpl->
rootLayer()); |
1688 root->setExpectation(false, true); | 1688 root->setExpectation(false, true); |
1689 root->setOpaque(true); | 1689 root->setOpaque(true); |
1690 | 1690 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1781 explicit FakeDrawableCCLayerImpl(int id) : CCLayerImpl(id) { } | 1781 explicit FakeDrawableCCLayerImpl(int id) : CCLayerImpl(id) { } |
1782 }; | 1782 }; |
1783 | 1783 |
1784 // Only reshape when we know we are going to draw. Otherwise, the reshape | 1784 // Only reshape when we know we are going to draw. Otherwise, the reshape |
1785 // can leave the window at the wrong size if we never draw and the proper | 1785 // can leave the window at the wrong size if we never draw and the proper |
1786 // viewport size is never set. | 1786 // viewport size is never set. |
1787 TEST_F(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw) | 1787 TEST_F(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw) |
1788 { | 1788 { |
1789 OwnPtr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create
(adoptPtr(new ReshapeTrackerContext)); | 1789 OwnPtr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create
(adoptPtr(new ReshapeTrackerContext)); |
1790 ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(
ccContext->context3D()); | 1790 ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(
ccContext->context3D()); |
1791 m_hostImpl->initializeRenderer(ccContext.release(), UnthrottledUploader); | 1791 m_hostImpl->initializeRenderer(ccContext.release()); |
1792 | 1792 |
1793 CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); | 1793 CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); |
1794 root->setAnchorPoint(FloatPoint(0, 0)); | 1794 root->setAnchorPoint(FloatPoint(0, 0)); |
1795 root->setBounds(IntSize(10, 10)); | 1795 root->setBounds(IntSize(10, 10)); |
1796 root->setDrawsContent(true); | 1796 root->setDrawsContent(true); |
1797 m_hostImpl->setRootLayer(adoptPtr(root)); | 1797 m_hostImpl->setRootLayer(adoptPtr(root)); |
1798 EXPECT_FALSE(reshapeTracker->reshapeCalled()); | 1798 EXPECT_FALSE(reshapeTracker->reshapeCalled()); |
1799 | 1799 |
1800 CCLayerTreeHostImpl::FrameData frame; | 1800 CCLayerTreeHostImpl::FrameData frame; |
1801 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); | 1801 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
(...skipping 28 matching lines...) Expand all Loading... |
1830 TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) | 1830 TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) |
1831 { | 1831 { |
1832 OwnPtr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create
(adoptPtr(new PartialSwapTrackerContext)); | 1832 OwnPtr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create
(adoptPtr(new PartialSwapTrackerContext)); |
1833 PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrack
erContext*>(ccContext->context3D()); | 1833 PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrack
erContext*>(ccContext->context3D()); |
1834 | 1834 |
1835 // This test creates its own CCLayerTreeHostImpl, so | 1835 // This test creates its own CCLayerTreeHostImpl, so |
1836 // that we can force partial swap enabled. | 1836 // that we can force partial swap enabled. |
1837 CCLayerTreeSettings settings; | 1837 CCLayerTreeSettings settings; |
1838 CCSettings::setPartialSwapEnabled(true); | 1838 CCSettings::setPartialSwapEnabled(true); |
1839 OwnPtr<CCLayerTreeHostImpl> layerTreeHostImpl = CCLayerTreeHostImpl::create(
settings, this); | 1839 OwnPtr<CCLayerTreeHostImpl> layerTreeHostImpl = CCLayerTreeHostImpl::create(
settings, this); |
1840 layerTreeHostImpl->initializeRenderer(ccContext.release(), UnthrottledUpload
er); | 1840 layerTreeHostImpl->initializeRenderer(ccContext.release()); |
1841 layerTreeHostImpl->setViewportSize(IntSize(500, 500), IntSize(500, 500)); | 1841 layerTreeHostImpl->setViewportSize(IntSize(500, 500), IntSize(500, 500)); |
1842 | 1842 |
1843 CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); | 1843 CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); |
1844 CCLayerImpl* child = new FakeDrawableCCLayerImpl(2); | 1844 CCLayerImpl* child = new FakeDrawableCCLayerImpl(2); |
1845 child->setPosition(FloatPoint(12, 13)); | 1845 child->setPosition(FloatPoint(12, 13)); |
1846 child->setAnchorPoint(FloatPoint(0, 0)); | 1846 child->setAnchorPoint(FloatPoint(0, 0)); |
1847 child->setBounds(IntSize(14, 15)); | 1847 child->setBounds(IntSize(14, 15)); |
1848 child->setContentBounds(IntSize(14, 15)); | 1848 child->setContentBounds(IntSize(14, 15)); |
1849 child->setDrawsContent(true); | 1849 child->setDrawsContent(true); |
1850 root->setAnchorPoint(FloatPoint(0, 0)); | 1850 root->setAnchorPoint(FloatPoint(0, 0)); |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2117 }; | 2117 }; |
2118 | 2118 |
2119 static PassOwnPtr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C
CLayerTreeHostImplClient* client) | 2119 static PassOwnPtr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C
CLayerTreeHostImplClient* client) |
2120 { | 2120 { |
2121 CCSettings::setPartialSwapEnabled(partialSwap); | 2121 CCSettings::setPartialSwapEnabled(partialSwap); |
2122 | 2122 |
2123 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 2123 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
2124 | 2124 |
2125 CCLayerTreeSettings settings; | 2125 CCLayerTreeSettings settings; |
2126 OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(setting
s, client); | 2126 OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(setting
s, client); |
2127 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); | 2127 myHostImpl->initializeRenderer(context.release()); |
2128 myHostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); | 2128 myHostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); |
2129 | 2129 |
2130 /* | 2130 /* |
2131 Layers are created as follows: | 2131 Layers are created as follows: |
2132 | 2132 |
2133 +--------------------+ | 2133 +--------------------+ |
2134 | 1 | | 2134 | 1 | |
2135 | +-----------+ | | 2135 | +-----------+ | |
2136 | | 2 | | | 2136 | | 2 | | |
2137 | | +-------------------+ | 2137 | | +-------------------+ |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2256 root->addChild(ContextLostNotificationCheckLayer::create(1)); | 2256 root->addChild(ContextLostNotificationCheckLayer::create(1)); |
2257 ContextLostNotificationCheckLayer* layer1 = static_cast<ContextLostNotificat
ionCheckLayer*>(root->children()[0]); | 2257 ContextLostNotificationCheckLayer* layer1 = static_cast<ContextLostNotificat
ionCheckLayer*>(root->children()[0]); |
2258 | 2258 |
2259 layer1->addChild(ContextLostNotificationCheckLayer::create(2)); | 2259 layer1->addChild(ContextLostNotificationCheckLayer::create(2)); |
2260 ContextLostNotificationCheckLayer* layer2 = static_cast<ContextLostNotificat
ionCheckLayer*>(layer1->children()[0]); | 2260 ContextLostNotificationCheckLayer* layer2 = static_cast<ContextLostNotificat
ionCheckLayer*>(layer1->children()[0]); |
2261 | 2261 |
2262 EXPECT_FALSE(root->didLoseContextCalled()); | 2262 EXPECT_FALSE(root->didLoseContextCalled()); |
2263 EXPECT_FALSE(layer1->didLoseContextCalled()); | 2263 EXPECT_FALSE(layer1->didLoseContextCalled()); |
2264 EXPECT_FALSE(layer2->didLoseContextCalled()); | 2264 EXPECT_FALSE(layer2->didLoseContextCalled()); |
2265 | 2265 |
2266 m_hostImpl->initializeRenderer(createContext(), UnthrottledUploader); | 2266 m_hostImpl->initializeRenderer(createContext()); |
2267 | 2267 |
2268 EXPECT_TRUE(root->didLoseContextCalled()); | 2268 EXPECT_TRUE(root->didLoseContextCalled()); |
2269 EXPECT_TRUE(layer1->didLoseContextCalled()); | 2269 EXPECT_TRUE(layer1->didLoseContextCalled()); |
2270 EXPECT_TRUE(layer2->didLoseContextCalled()); | 2270 EXPECT_TRUE(layer2->didLoseContextCalled()); |
2271 } | 2271 } |
2272 | 2272 |
2273 TEST_F(CCLayerTreeHostImplTest, finishAllRenderingAfterContextLost) | 2273 TEST_F(CCLayerTreeHostImplTest, finishAllRenderingAfterContextLost) |
2274 { | 2274 { |
2275 CCLayerTreeSettings settings; | 2275 CCLayerTreeSettings settings; |
2276 m_hostImpl = CCLayerTreeHostImpl::create(settings, this); | 2276 m_hostImpl = CCLayerTreeHostImpl::create(settings, this); |
2277 | 2277 |
2278 // The context initialization will fail, but we should still be able to call
finishAllRendering() without any ill effects. | 2278 // The context initialization will fail, but we should still be able to call
finishAllRendering() without any ill effects. |
2279 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new FakeWebGraphicsContext3DMakeCurrentFails)), UnthrottledUploader); | 2279 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new FakeWebGraphicsContext3DMakeCurrentFails))); |
2280 m_hostImpl->finishAllRendering(); | 2280 m_hostImpl->finishAllRendering(); |
2281 } | 2281 } |
2282 | 2282 |
2283 // Fake WebGraphicsContext3D that will cause a failure if trying to use a | 2283 // Fake WebGraphicsContext3D that will cause a failure if trying to use a |
2284 // resource that wasn't created by it (resources created by | 2284 // resource that wasn't created by it (resources created by |
2285 // FakeWebGraphicsContext3D have an id of 1). | 2285 // FakeWebGraphicsContext3D have an id of 1). |
2286 class StrictWebGraphicsContext3D : public FakeWebGraphicsContext3D { | 2286 class StrictWebGraphicsContext3D : public FakeWebGraphicsContext3D { |
2287 public: | 2287 public: |
2288 StrictWebGraphicsContext3D() | 2288 StrictWebGraphicsContext3D() |
2289 : FakeWebGraphicsContext3D() | 2289 : FakeWebGraphicsContext3D() |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2575 delegatedRendererLayer->setContentBounds(IntSize(10, 10)); | 2575 delegatedRendererLayer->setContentBounds(IntSize(10, 10)); |
2576 delegatedRendererLayer->setDrawsContent(true); | 2576 delegatedRendererLayer->setDrawsContent(true); |
2577 delegatedRendererLayer->setLayerTreeHostImpl(m_hostImpl.get()); | 2577 delegatedRendererLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
2578 OwnPtrVector<CCRenderPass> passList; | 2578 OwnPtrVector<CCRenderPass> passList; |
2579 passList.append(createRenderPassWithResource(m_hostImpl->resourceProvider())
); | 2579 passList.append(createRenderPassWithResource(m_hostImpl->resourceProvider())
); |
2580 delegatedRendererLayer->setRenderPasses(passList); | 2580 delegatedRendererLayer->setRenderPasses(passList); |
2581 EXPECT_TRUE(passList.isEmpty()); | 2581 EXPECT_TRUE(passList.isEmpty()); |
2582 rootLayer->addChild(delegatedRendererLayer.release()); | 2582 rootLayer->addChild(delegatedRendererLayer.release()); |
2583 | 2583 |
2584 // Use a context that supports IOSurfaces | 2584 // Use a context that supports IOSurfaces |
2585 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new FakeWebGraphicsContext3DWithIOSurface)), UnthrottledUploader); | 2585 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new FakeWebGraphicsContext3DWithIOSurface))); |
2586 | 2586 |
2587 hwVideoFrame.setTextureId(m_hostImpl->resourceProvider()->graphicsContext3D(
)->createTexture()); | 2587 hwVideoFrame.setTextureId(m_hostImpl->resourceProvider()->graphicsContext3D(
)->createTexture()); |
2588 | 2588 |
2589 m_hostImpl->setRootLayer(rootLayer.release()); | 2589 m_hostImpl->setRootLayer(rootLayer.release()); |
2590 | 2590 |
2591 CCLayerTreeHostImpl::FrameData frame; | 2591 CCLayerTreeHostImpl::FrameData frame; |
2592 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); | 2592 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
2593 m_hostImpl->drawLayers(frame); | 2593 m_hostImpl->drawLayers(frame); |
2594 m_hostImpl->didDrawAllLayers(frame); | 2594 m_hostImpl->didDrawAllLayers(frame); |
2595 m_hostImpl->swapBuffers(); | 2595 m_hostImpl->swapBuffers(); |
2596 | 2596 |
2597 unsigned numResources = m_hostImpl->resourceProvider()->numResources(); | 2597 unsigned numResources = m_hostImpl->resourceProvider()->numResources(); |
2598 | 2598 |
2599 // Lose the context, replacing it with a StrictWebGraphicsContext3DWithIOSur
face, | 2599 // Lose the context, replacing it with a StrictWebGraphicsContext3DWithIOSur
face, |
2600 // that will warn if any resource from the previous context gets used. | 2600 // that will warn if any resource from the previous context gets used. |
2601 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new StrictWebGraphicsContext3DWithIOSurface)), UnthrottledUploader); | 2601 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new StrictWebGraphicsContext3DWithIOSurface))); |
2602 | 2602 |
2603 // Create dummy resources so that looking up an old resource will get an | 2603 // Create dummy resources so that looking up an old resource will get an |
2604 // invalid texture id mapping. | 2604 // invalid texture id mapping. |
2605 for (unsigned i = 0; i < numResources; ++i) | 2605 for (unsigned i = 0; i < numResources; ++i) |
2606 m_hostImpl->resourceProvider()->createResourceFromExternalTexture(1); | 2606 m_hostImpl->resourceProvider()->createResourceFromExternalTexture(1); |
2607 | 2607 |
2608 // The WebVideoFrameProvider is expected to recreate its textures after a | 2608 // The WebVideoFrameProvider is expected to recreate its textures after a |
2609 // lost context (or not serve a frame). | 2609 // lost context (or not serve a frame). |
2610 hwProvider.setFrame(0); | 2610 hwProvider.setFrame(0); |
2611 | 2611 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2704 ioSurfaceLayer->setAnchorPoint(FloatPoint(0, 0)); | 2704 ioSurfaceLayer->setAnchorPoint(FloatPoint(0, 0)); |
2705 ioSurfaceLayer->setContentBounds(IntSize(10, 10)); | 2705 ioSurfaceLayer->setContentBounds(IntSize(10, 10)); |
2706 ioSurfaceLayer->setDrawsContent(true); | 2706 ioSurfaceLayer->setDrawsContent(true); |
2707 ioSurfaceLayer->setIOSurfaceProperties(1, IntSize(10, 10)); | 2707 ioSurfaceLayer->setIOSurfaceProperties(1, IntSize(10, 10)); |
2708 ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get()); | 2708 ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
2709 rootLayer->addChild(ioSurfaceLayer.release()); | 2709 rootLayer->addChild(ioSurfaceLayer.release()); |
2710 | 2710 |
2711 // Lose the context, replacing it with a TrackingWebGraphicsContext3D (which
the CCLayerTreeHostImpl takes ownership of). | 2711 // Lose the context, replacing it with a TrackingWebGraphicsContext3D (which
the CCLayerTreeHostImpl takes ownership of). |
2712 OwnPtr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(a
doptPtr(new TrackingWebGraphicsContext3D))); | 2712 OwnPtr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(a
doptPtr(new TrackingWebGraphicsContext3D))); |
2713 TrackingWebGraphicsContext3D* trackingWebGraphicsContext = static_cast<Track
ingWebGraphicsContext3D*>(ccContext->context3D()); | 2713 TrackingWebGraphicsContext3D* trackingWebGraphicsContext = static_cast<Track
ingWebGraphicsContext3D*>(ccContext->context3D()); |
2714 m_hostImpl->initializeRenderer(ccContext.release(), UnthrottledUploader); | 2714 m_hostImpl->initializeRenderer(ccContext.release()); |
2715 | 2715 |
2716 m_hostImpl->setRootLayer(rootLayer.release()); | 2716 m_hostImpl->setRootLayer(rootLayer.release()); |
2717 | 2717 |
2718 CCLayerTreeHostImpl::FrameData frame; | 2718 CCLayerTreeHostImpl::FrameData frame; |
2719 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); | 2719 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
2720 m_hostImpl->drawLayers(frame); | 2720 m_hostImpl->drawLayers(frame); |
2721 m_hostImpl->didDrawAllLayers(frame); | 2721 m_hostImpl->didDrawAllLayers(frame); |
2722 m_hostImpl->swapBuffers(); | 2722 m_hostImpl->swapBuffers(); |
2723 | 2723 |
2724 EXPECT_GT(trackingWebGraphicsContext->numTextures(), 0u); | 2724 EXPECT_GT(trackingWebGraphicsContext->numTextures(), 0u); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2776 layerPtr->setOpaque(true); | 2776 layerPtr->setOpaque(true); |
2777 parent->addChild(layer.release()); | 2777 parent->addChild(layer.release()); |
2778 if (result) | 2778 if (result) |
2779 *result = layerPtr; | 2779 *result = layerPtr; |
2780 } | 2780 } |
2781 | 2781 |
2782 static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl,
CCLayerImpl*& rootPtr, CCLayerImpl*& intermediateLayerPtr, CCLayerImpl*& surfac
eLayerPtr, CCLayerImpl*& childPtr, const IntSize& rootSize) | 2782 static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl,
CCLayerImpl*& rootPtr, CCLayerImpl*& intermediateLayerPtr, CCLayerImpl*& surfac
eLayerPtr, CCLayerImpl*& childPtr, const IntSize& rootSize) |
2783 { | 2783 { |
2784 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 2784 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
2785 | 2785 |
2786 layerTreeHostImpl->initializeRenderer(context.release(), UnthrottledUploader
); | 2786 layerTreeHostImpl->initializeRenderer(context.release()); |
2787 layerTreeHostImpl->setViewportSize(rootSize, rootSize); | 2787 layerTreeHostImpl->setViewportSize(rootSize, rootSize); |
2788 | 2788 |
2789 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 2789 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
2790 rootPtr = root.get(); | 2790 rootPtr = root.get(); |
2791 | 2791 |
2792 root->setAnchorPoint(FloatPoint(0, 0)); | 2792 root->setAnchorPoint(FloatPoint(0, 0)); |
2793 root->setPosition(FloatPoint(0, 0)); | 2793 root->setPosition(FloatPoint(0, 0)); |
2794 root->setBounds(rootSize); | 2794 root->setBounds(rootSize); |
2795 root->setContentBounds(rootSize); | 2795 root->setContentBounds(rootSize); |
2796 root->setDrawsContent(true); | 2796 root->setDrawsContent(true); |
(...skipping 25 matching lines...) Expand all Loading... |
2822 settings.minimumOcclusionTrackingSize = IntSize(); | 2822 settings.minimumOcclusionTrackingSize = IntSize(); |
2823 OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(setting
s, this); | 2823 OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(setting
s, this); |
2824 | 2824 |
2825 CCLayerImpl* rootPtr; | 2825 CCLayerImpl* rootPtr; |
2826 CCLayerImpl* surfaceLayerPtr; | 2826 CCLayerImpl* surfaceLayerPtr; |
2827 | 2827 |
2828 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 2828 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
2829 | 2829 |
2830 IntSize rootSize(100, 100); | 2830 IntSize rootSize(100, 100); |
2831 | 2831 |
2832 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); | 2832 myHostImpl->initializeRenderer(context.release()); |
2833 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); | 2833 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); |
2834 | 2834 |
2835 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 2835 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
2836 rootPtr = root.get(); | 2836 rootPtr = root.get(); |
2837 | 2837 |
2838 root->setAnchorPoint(FloatPoint(0, 0)); | 2838 root->setAnchorPoint(FloatPoint(0, 0)); |
2839 root->setPosition(FloatPoint(0, 0)); | 2839 root->setPosition(FloatPoint(0, 0)); |
2840 root->setBounds(rootSize); | 2840 root->setBounds(rootSize); |
2841 root->setContentBounds(rootSize); | 2841 root->setContentBounds(rootSize); |
2842 root->setDrawsContent(true); | 2842 root->setDrawsContent(true); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2934 // L21 occludes L20 (internal) | 2934 // L21 occludes L20 (internal) |
2935 | 2935 |
2936 CCLayerImpl* rootPtr; | 2936 CCLayerImpl* rootPtr; |
2937 CCLayerImpl* layerS1Ptr; | 2937 CCLayerImpl* layerS1Ptr; |
2938 CCLayerImpl* layerS2Ptr; | 2938 CCLayerImpl* layerS2Ptr; |
2939 | 2939 |
2940 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 2940 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
2941 | 2941 |
2942 IntSize rootSize(1000, 1000); | 2942 IntSize rootSize(1000, 1000); |
2943 | 2943 |
2944 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); | 2944 myHostImpl->initializeRenderer(context.release()); |
2945 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); | 2945 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); |
2946 | 2946 |
2947 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 2947 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
2948 rootPtr = root.get(); | 2948 rootPtr = root.get(); |
2949 | 2949 |
2950 root->setAnchorPoint(FloatPoint(0, 0)); | 2950 root->setAnchorPoint(FloatPoint(0, 0)); |
2951 root->setPosition(FloatPoint(0, 0)); | 2951 root->setPosition(FloatPoint(0, 0)); |
2952 root->setBounds(rootSize); | 2952 root->setBounds(rootSize); |
2953 root->setContentBounds(rootSize); | 2953 root->setContentBounds(rootSize); |
2954 root->setDrawsContent(true); | 2954 root->setDrawsContent(true); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3047 // | 3047 // |
3048 | 3048 |
3049 CCLayerImpl* rootPtr; | 3049 CCLayerImpl* rootPtr; |
3050 CCLayerImpl* layerS1Ptr; | 3050 CCLayerImpl* layerS1Ptr; |
3051 CCLayerImpl* layerS2Ptr; | 3051 CCLayerImpl* layerS2Ptr; |
3052 | 3052 |
3053 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 3053 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
3054 | 3054 |
3055 IntSize rootSize(1000, 1000); | 3055 IntSize rootSize(1000, 1000); |
3056 | 3056 |
3057 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); | 3057 myHostImpl->initializeRenderer(context.release()); |
3058 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); | 3058 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); |
3059 | 3059 |
3060 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 3060 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
3061 rootPtr = root.get(); | 3061 rootPtr = root.get(); |
3062 | 3062 |
3063 root->setAnchorPoint(FloatPoint(0, 0)); | 3063 root->setAnchorPoint(FloatPoint(0, 0)); |
3064 root->setPosition(FloatPoint(0, 0)); | 3064 root->setPosition(FloatPoint(0, 0)); |
3065 root->setBounds(rootSize); | 3065 root->setBounds(rootSize); |
3066 root->setContentBounds(rootSize); | 3066 root->setContentBounds(rootSize); |
3067 root->setDrawsContent(true); | 3067 root->setDrawsContent(true); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3161 // | 3161 // |
3162 | 3162 |
3163 CCLayerImpl* rootPtr; | 3163 CCLayerImpl* rootPtr; |
3164 CCLayerImpl* layerS1Ptr; | 3164 CCLayerImpl* layerS1Ptr; |
3165 CCLayerImpl* layerS2Ptr; | 3165 CCLayerImpl* layerS2Ptr; |
3166 | 3166 |
3167 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 3167 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
3168 | 3168 |
3169 IntSize rootSize(1000, 1000); | 3169 IntSize rootSize(1000, 1000); |
3170 | 3170 |
3171 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); | 3171 myHostImpl->initializeRenderer(context.release()); |
3172 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); | 3172 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); |
3173 | 3173 |
3174 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 3174 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
3175 rootPtr = root.get(); | 3175 rootPtr = root.get(); |
3176 | 3176 |
3177 root->setAnchorPoint(FloatPoint(0, 0)); | 3177 root->setAnchorPoint(FloatPoint(0, 0)); |
3178 root->setPosition(FloatPoint(0, 0)); | 3178 root->setPosition(FloatPoint(0, 0)); |
3179 root->setBounds(rootSize); | 3179 root->setBounds(rootSize); |
3180 root->setContentBounds(rootSize); | 3180 root->setContentBounds(rootSize); |
3181 root->setDrawsContent(true); | 3181 root->setDrawsContent(true); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3244 // R +-- S1 +- L10 (rotated, drawing) | 3244 // R +-- S1 +- L10 (rotated, drawing) |
3245 // +- L11 (occupies half surface) | 3245 // +- L11 (occupies half surface) |
3246 | 3246 |
3247 CCLayerImpl* rootPtr; | 3247 CCLayerImpl* rootPtr; |
3248 CCLayerImpl* layerS1Ptr; | 3248 CCLayerImpl* layerS1Ptr; |
3249 | 3249 |
3250 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 3250 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
3251 | 3251 |
3252 IntSize rootSize(1000, 1000); | 3252 IntSize rootSize(1000, 1000); |
3253 | 3253 |
3254 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); | 3254 myHostImpl->initializeRenderer(context.release()); |
3255 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); | 3255 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); |
3256 | 3256 |
3257 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 3257 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
3258 rootPtr = root.get(); | 3258 rootPtr = root.get(); |
3259 | 3259 |
3260 root->setAnchorPoint(FloatPoint(0, 0)); | 3260 root->setAnchorPoint(FloatPoint(0, 0)); |
3261 root->setPosition(FloatPoint(0, 0)); | 3261 root->setPosition(FloatPoint(0, 0)); |
3262 root->setBounds(rootSize); | 3262 root->setBounds(rootSize); |
3263 root->setContentBounds(rootSize); | 3263 root->setContentBounds(rootSize); |
3264 root->setDrawsContent(true); | 3264 root->setDrawsContent(true); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3329 // L21 occludes L20 (internal) | 3329 // L21 occludes L20 (internal) |
3330 | 3330 |
3331 CCLayerImpl* rootPtr; | 3331 CCLayerImpl* rootPtr; |
3332 CCLayerImpl* layerS1Ptr; | 3332 CCLayerImpl* layerS1Ptr; |
3333 CCLayerImpl* layerS2Ptr; | 3333 CCLayerImpl* layerS2Ptr; |
3334 | 3334 |
3335 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 3335 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
3336 | 3336 |
3337 IntSize rootSize(1000, 1000); | 3337 IntSize rootSize(1000, 1000); |
3338 | 3338 |
3339 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); | 3339 myHostImpl->initializeRenderer(context.release()); |
3340 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); | 3340 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); |
3341 | 3341 |
3342 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 3342 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
3343 rootPtr = root.get(); | 3343 rootPtr = root.get(); |
3344 | 3344 |
3345 root->setAnchorPoint(FloatPoint(0, 0)); | 3345 root->setAnchorPoint(FloatPoint(0, 0)); |
3346 root->setPosition(FloatPoint(0, 0)); | 3346 root->setPosition(FloatPoint(0, 0)); |
3347 root->setBounds(rootSize); | 3347 root->setBounds(rootSize); |
3348 root->setContentBounds(rootSize); | 3348 root->setContentBounds(rootSize); |
3349 root->setDrawsContent(true); | 3349 root->setDrawsContent(true); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3447 */ | 3447 */ |
3448 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 3448 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
3449 OwnPtr<CCTiledLayerImpl> child = CCTiledLayerImpl::create(2); | 3449 OwnPtr<CCTiledLayerImpl> child = CCTiledLayerImpl::create(2); |
3450 OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(3); | 3450 OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(3); |
3451 | 3451 |
3452 IntRect rootRect(0, 0, 100, 100); | 3452 IntRect rootRect(0, 0, 100, 100); |
3453 IntRect childRect(10, 10, 50, 50); | 3453 IntRect childRect(10, 10, 50, 50); |
3454 IntRect grandChildRect(5, 5, 150, 150); | 3454 IntRect grandChildRect(5, 5, 150, 150); |
3455 | 3455 |
3456 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 3456 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
3457 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); | 3457 myHostImpl->initializeRenderer(context.release()); |
3458 | 3458 |
3459 root->setAnchorPoint(FloatPoint(0, 0)); | 3459 root->setAnchorPoint(FloatPoint(0, 0)); |
3460 root->setPosition(FloatPoint(rootRect.x(), rootRect.y())); | 3460 root->setPosition(FloatPoint(rootRect.x(), rootRect.y())); |
3461 root->setBounds(IntSize(rootRect.width(), rootRect.height())); | 3461 root->setBounds(IntSize(rootRect.width(), rootRect.height())); |
3462 root->setContentBounds(root->bounds()); | 3462 root->setContentBounds(root->bounds()); |
3463 root->setDrawsContent(true); | 3463 root->setDrawsContent(true); |
3464 root->setMasksToBounds(true); | 3464 root->setMasksToBounds(true); |
3465 | 3465 |
3466 child->setAnchorPoint(FloatPoint(0, 0)); | 3466 child->setAnchorPoint(FloatPoint(0, 0)); |
3467 child->setPosition(FloatPoint(childRect.x(), childRect.y())); | 3467 child->setPosition(FloatPoint(childRect.x(), childRect.y())); |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4194 { | 4194 { |
4195 char actualResult[1024]; | 4195 char actualResult[1024]; |
4196 dumpRenderPassTestData(testData, actualResult); | 4196 dumpRenderPassTestData(testData, actualResult); |
4197 EXPECT_STREQ(testCase.expectedResult, actualResult) << "In test case: " << t
estCase.name; | 4197 EXPECT_STREQ(testCase.expectedResult, actualResult) << "In test case: " << t
estCase.name; |
4198 } | 4198 } |
4199 | 4199 |
4200 TEST_F(CCLayerTreeHostImplTest, testRemoveRenderPasses) | 4200 TEST_F(CCLayerTreeHostImplTest, testRemoveRenderPasses) |
4201 { | 4201 { |
4202 OwnPtr<CCGraphicsContext> context(createContext()); | 4202 OwnPtr<CCGraphicsContext> context(createContext()); |
4203 ASSERT_TRUE(context->context3D()); | 4203 ASSERT_TRUE(context->context3D()); |
4204 OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(conte
xt.get(), UnthrottledUploader)); | 4204 OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(conte
xt.get())); |
4205 | 4205 |
4206 OwnPtr<CCTestRenderer> renderer(CCTestRenderer::create(resourceProvider.get(
))); | 4206 OwnPtr<CCTestRenderer> renderer(CCTestRenderer::create(resourceProvider.get(
))); |
4207 | 4207 |
4208 int testCaseIndex = 0; | 4208 int testCaseIndex = 0; |
4209 while (removeRenderPassesCases[testCaseIndex].name) { | 4209 while (removeRenderPassesCases[testCaseIndex].name) { |
4210 RenderPassRemovalTestData testData; | 4210 RenderPassRemovalTestData testData; |
4211 configureRenderPassTestData(removeRenderPassesCases[testCaseIndex].initS
cript, testData, renderer.get()); | 4211 configureRenderPassTestData(removeRenderPassesCases[testCaseIndex].initS
cript, testData, renderer.get()); |
4212 CCLayerTreeHostImpl::removeRenderPasses(CCLayerTreeHostImpl::CullRenderP
assesWithCachedTextures(*renderer), testData); | 4212 CCLayerTreeHostImpl::removeRenderPasses(CCLayerTreeHostImpl::CullRenderP
assesWithCachedTextures(*renderer), testData); |
4213 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat
a); | 4213 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat
a); |
4214 testCaseIndex++; | 4214 testCaseIndex++; |
4215 } | 4215 } |
4216 } | 4216 } |
4217 | 4217 |
4218 } // namespace | 4218 } // namespace |
OLD | NEW |