diff options
author | shawnsingh@chromium.org <shawnsingh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-30 20:45:42 +0000 |
---|---|---|
committer | shawnsingh@chromium.org <shawnsingh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-30 20:45:42 +0000 |
commit | ecc12621a9594424a2ea7347b13e71888fd3c308 (patch) | |
tree | 95ce5ab9b1bb67056474b05cb005414749a30ea2 /cc/layer_tree_host_impl_unittest.cc | |
parent | 45c5a2068dbd71f7e5510ed5a2ca7b89489585cb (diff) | |
download | chromium_src-ecc12621a9594424a2ea7347b13e71888fd3c308.zip chromium_src-ecc12621a9594424a2ea7347b13e71888fd3c308.tar.gz chromium_src-ecc12621a9594424a2ea7347b13e71888fd3c308.tar.bz2 |
Remove root layer specialness in calculateDrawTransforms
This patch is step 2 in removing root layer specialness. The previous patch removed root
layer specialness from code outside of CCLayerTreeHostCommon, this patch removes it from
within CCLayerTreeHostCommon.
One subtle semantics change occurs with this patch, that only affects tests and not
real-world code: The root renderSurface now re-parents the root layer's drawTransform. In
practice, the root layer's drawTransform is always an identity matrix, so it does not
matter.
BUG=154442
Review URL: https://chromiumcodereview.appspot.com/11276061
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165000 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layer_tree_host_impl_unittest.cc')
-rw-r--r-- | cc/layer_tree_host_impl_unittest.cc | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc index 2d50654..e2ecdce 100644 --- a/cc/layer_tree_host_impl_unittest.cc +++ b/cc/layer_tree_host_impl_unittest.cc @@ -1791,19 +1791,20 @@ TEST_P(LayerTreeHostImplTest, viewportCovered) IntSize viewportSize(1000, 1000); m_hostImpl->setViewportSize(viewportSize, viewportSize); - m_hostImpl->setRootLayer(BlendStateCheckLayer::create(1, m_hostImpl->resourceProvider())); - BlendStateCheckLayer* root = static_cast<BlendStateCheckLayer*>(m_hostImpl->rootLayer()); - root->setExpectation(false, true); - root->setContentsOpaque(true); + m_hostImpl->setRootLayer(LayerImpl::create(1)); + m_hostImpl->rootLayer()->addChild(BlendStateCheckLayer::create(2, m_hostImpl->resourceProvider())); + BlendStateCheckLayer* child = static_cast<BlendStateCheckLayer*>(m_hostImpl->rootLayer()->children()[0]); + child->setExpectation(false, false); + child->setContentsOpaque(true); // No gutter rects { IntRect layerRect(0, 0, 1000, 1000); - root->setPosition(layerRect.location()); - root->setBounds(layerRect.size()); - root->setContentBounds(layerRect.size()); - root->setQuadRect(IntRect(IntPoint(), layerRect.size())); - root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size())); + child->setPosition(layerRect.location()); + child->setBounds(layerRect.size()); + child->setContentBounds(layerRect.size()); + child->setQuadRect(IntRect(IntPoint(), layerRect.size())); + child->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size())); LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); @@ -1815,18 +1816,18 @@ TEST_P(LayerTreeHostImplTest, viewportCovered) EXPECT_EQ(0u, numGutterQuads); EXPECT_EQ(1u, frame.renderPasses[0]->quadList().size()); - verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), IntRect(-layerRect.location(), viewportSize)); + verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), IntRect(IntPoint::zero(), viewportSize)); m_hostImpl->didDrawAllLayers(frame); } // Empty visible content area (fullscreen gutter rect) { IntRect layerRect(0, 0, 0, 0); - root->setPosition(layerRect.location()); - root->setBounds(layerRect.size()); - root->setContentBounds(layerRect.size()); - root->setQuadRect(IntRect(IntPoint(), layerRect.size())); - root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size())); + child->setPosition(layerRect.location()); + child->setBounds(layerRect.size()); + child->setContentBounds(layerRect.size()); + child->setQuadRect(IntRect(IntPoint(), layerRect.size())); + child->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size())); LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); @@ -1839,18 +1840,18 @@ TEST_P(LayerTreeHostImplTest, viewportCovered) EXPECT_EQ(1u, numGutterQuads); EXPECT_EQ(1u, frame.renderPasses[0]->quadList().size()); - verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), IntRect(-layerRect.location(), viewportSize)); + verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), IntRect(IntPoint::zero(), viewportSize)); m_hostImpl->didDrawAllLayers(frame); } // Content area in middle of clip rect (four surrounding gutter rects) { IntRect layerRect(500, 500, 200, 200); - root->setPosition(layerRect.location()); - root->setBounds(layerRect.size()); - root->setContentBounds(layerRect.size()); - root->setQuadRect(IntRect(IntPoint(), layerRect.size())); - root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size())); + child->setPosition(layerRect.location()); + child->setBounds(layerRect.size()); + child->setContentBounds(layerRect.size()); + child->setQuadRect(IntRect(IntPoint(), layerRect.size())); + child->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size())); LayerTreeHostImpl::FrameData frame; EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); @@ -1862,7 +1863,7 @@ TEST_P(LayerTreeHostImplTest, viewportCovered) EXPECT_EQ(4u, numGutterQuads); EXPECT_EQ(5u, frame.renderPasses[0]->quadList().size()); - verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), IntRect(-layerRect.location(), viewportSize)); + verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), IntRect(IntPoint::zero(), viewportSize)); m_hostImpl->didDrawAllLayers(frame); } |