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

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: Rebase 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
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6847f9c35bcbb92b68f70a05992ea6b1cef69c30..04ffc328ae58dae861d28058a4bc8740c66c2aa1 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();
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698