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

Unified Diff: cc/layer_tree_host_common_unittest.cc

Issue 11316171: Don't create render passes for transparent images. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 8 years, 1 month 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.cc ('k') | cc/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_common_unittest.cc
diff --git a/cc/layer_tree_host_common_unittest.cc b/cc/layer_tree_host_common_unittest.cc
index 6933335c5837f9ed177883227ef37d5c64d5bec3..a1f69235cbbc84acef4de5300e9dc0cb9d48604f 100644
--- a/cc/layer_tree_host_common_unittest.cc
+++ b/cc/layer_tree_host_common_unittest.cc
@@ -327,6 +327,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface)
// Child is set up so that a new render surface should be created.
child->setOpacity(0.5);
+ child->setForceRenderSurface(true);
gfx::Transform parentLayerTransform;
parentLayerTransform.Scale3d(1, 0.9, 1);
@@ -1355,6 +1356,7 @@ TEST(LayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces)
child->setMasksToBounds(true);
child->setOpacity(0.4f);
+ child->setForceRenderSurface(true);
grandChild->setOpacity(0.5);
greatGrandChild->setOpacity(0.4f);
@@ -1401,7 +1403,9 @@ TEST(LayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent)
parent->setMasksToBounds(true);
child->setOpacity(0.4f);
+ child->setForceRenderSurface(true);
grandChild->setOpacity(0.4f);
+ grandChild->setForceRenderSurface(true);
std::vector<scoped_refptr<Layer> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
@@ -1629,10 +1633,15 @@ TEST(LayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces)
// Force everyone to be a render surface.
child->setOpacity(0.4f);
+ child->setForceRenderSurface(true);
grandChild1->setOpacity(0.5);
+ grandChild1->setForceRenderSurface(true);
grandChild2->setOpacity(0.5);
+ grandChild2->setForceRenderSurface(true);
grandChild3->setOpacity(0.5);
+ grandChild3->setForceRenderSurface(true);
grandChild4->setOpacity(0.5);
+ grandChild4->setForceRenderSurface(true);
std::vector<scoped_refptr<Layer> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
@@ -4611,5 +4620,25 @@ TEST(LayerTreeHostCommonTest, verifySubtreeSearch)
EXPECT_EQ(0, LayerTreeHostCommon::findLayerInSubtree(root.get(), nonexistentId));
}
+TEST(LayerTreeHostCommonTest, verifyTransparentChildRenderSurfaceCreation)
+{
+ scoped_refptr<Layer> root = Layer::create();
+ scoped_refptr<Layer> child = Layer::create();
+ scoped_refptr<LayerWithForcedDrawsContent> grandChild = make_scoped_refptr(new LayerWithForcedDrawsContent());
+
+ const gfx::Transform identityMatrix;
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
+
+ root->addChild(child);
+ child->addChild(grandChild);
+ child->setOpacity(0.5f);
+
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ EXPECT_FALSE(child->renderSurface());
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/layer_tree_host_common.cc ('k') | cc/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698