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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 24280009: Move tile-free-software render surface disabling to UpdateDrawProperties. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
Index: cc/trees/layer_tree_host_common_unittest.cc
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index 5ce103465d8ac666188e6a2a05c24e2100be0366..aa56fbc90fba1c9d9d651703f23b1ce4f5f85e01 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -8883,6 +8883,84 @@ TEST_F(LayerTreeHostCommonTest,
EXPECT_EQ(0, render_surface2->num_unclipped_descendants());
}
+TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
+ FakeImplProxy proxy;
+ FakeLayerTreeHostImpl host_impl(&proxy);
+ scoped_ptr<LayerImpl> root =
+ LayerImpl::Create(host_impl.active_tree(), 12345);
+ scoped_ptr<LayerImpl> child1 =
+ LayerImpl::Create(host_impl.active_tree(), 123456);
+ scoped_ptr<LayerImpl> child2 =
+ LayerImpl::Create(host_impl.active_tree(), 1234567);
+ scoped_ptr<LayerImpl> child3 =
+ LayerImpl::Create(host_impl.active_tree(), 12345678);
+
+ gfx::Transform identity_matrix;
+ gfx::PointF anchor;
+ gfx::PointF position;
+ gfx::Size bounds(100, 100);
+ SetLayerPropertiesForTesting(root.get(),
+ identity_matrix,
+ identity_matrix,
+ anchor,
+ position,
+ bounds,
+ false);
+ root->SetDrawsContent(true);
+
+ // This layer structure normally forces render surface due to preserves3d
+ // behavior.
+ bool preserves3d = true;
+ SetLayerPropertiesForTesting(child1.get(),
+ identity_matrix,
+ identity_matrix,
+ anchor,
+ position,
+ bounds,
+ preserves3d);
+ child1->SetDrawsContent(true);
+ SetLayerPropertiesForTesting(child2.get(),
+ identity_matrix,
+ identity_matrix,
+ anchor,
+ position,
+ bounds,
+ false);
+ child2->SetDrawsContent(true);
+ SetLayerPropertiesForTesting(child3.get(),
+ identity_matrix,
+ identity_matrix,
+ anchor,
+ position,
+ bounds,
+ false);
+ child3->SetDrawsContent(true);
+
+ child2->AddChild(child3.Pass());
+ child1->AddChild(child2.Pass());
+ root->AddChild(child1.Pass());
+
+ {
+ LayerImplList render_surface_layer_list;
+ LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
+ root.get(), root->bounds(), &render_surface_layer_list);
+ inputs.can_render_to_separate_surface = true;
+ LayerTreeHostCommon::CalculateDrawProperties(&inputs);
+
+ EXPECT_EQ(2u, render_surface_layer_list.size());
+ }
+
+ {
+ LayerImplList render_surface_layer_list;
+ LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
+ root.get(), root->bounds(), &render_surface_layer_list);
+ inputs.can_render_to_separate_surface = false;
+ LayerTreeHostCommon::CalculateDrawProperties(&inputs);
+
+ EXPECT_EQ(1u, render_surface_layer_list.size());
+ }
+}
+
TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleSurfaces) {
scoped_refptr<Layer> root = Layer::Create();
scoped_refptr<Layer> render_surface = Layer::Create();

Powered by Google App Engine
This is Rietveld 408576698