Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Unified Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11017044: Remove root layer specialness in calculateDrawTransforms (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added assertion that rounding does not affect exact coverage testing Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layer_tree_host_common_unittest.cc ('k') | cc/layer_tree_host_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_impl_unittest.cc
diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc
index 64cec3bfd0a54cd4c3f6c7829711783aaf4c7b9b..5be265c55ffff06f367ad73f601eb15269187bb8 100644
--- a/cc/layer_tree_host_impl_unittest.cc
+++ b/cc/layer_tree_host_impl_unittest.cc
@@ -1786,19 +1786,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));
@@ -1810,18 +1811,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));
@@ -1834,18 +1835,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));
@@ -1857,7 +1858,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);
}
« no previous file with comments | « cc/layer_tree_host_common_unittest.cc ('k') | cc/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698