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

Side by Side Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 250803013: Don't clear render surfaces unnecessarily. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make the bots happy. Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "cc/animation/layer_animation_controller.h" 9 #include "cc/animation/layer_animation_controller.h"
10 #include "cc/animation/transform_operations.h" 10 #include "cc/animation/transform_operations.h"
(...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 gfx::Transform(), 1449 gfx::Transform(),
1450 &render_surface_layer_list); 1450 &render_surface_layer_list);
1451 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 1451 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
1452 1452
1453 // The child layer's content is entirely outside the parent's clip rect, so 1453 // The child layer's content is entirely outside the parent's clip rect, so
1454 // the intermediate render surface should not be listed here, even if it was 1454 // the intermediate render surface should not be listed here, even if it was
1455 // forced to be created. Render surfaces without children or visible content 1455 // forced to be created. Render surfaces without children or visible content
1456 // are unexpected at draw time (e.g. we might try to create a content texture 1456 // are unexpected at draw time (e.g. we might try to create a content texture
1457 // of size 0). 1457 // of size 0).
1458 ASSERT_TRUE(parent->render_surface()); 1458 ASSERT_TRUE(parent->render_surface());
1459 ASSERT_FALSE(render_surface1->render_surface());
1460 EXPECT_EQ(1U, render_surface_layer_list.size()); 1459 EXPECT_EQ(1U, render_surface_layer_list.size());
1461 } 1460 }
1462 1461
1463 TEST_F(LayerTreeHostCommonTest, RenderSurfaceListForTransparentChild) { 1462 TEST_F(LayerTreeHostCommonTest, RenderSurfaceListForTransparentChild) {
1464 scoped_refptr<Layer> parent = Layer::Create(); 1463 scoped_refptr<Layer> parent = Layer::Create();
1465 scoped_refptr<Layer> render_surface1 = Layer::Create(); 1464 scoped_refptr<Layer> render_surface1 = Layer::Create();
1466 scoped_refptr<LayerWithForcedDrawsContent> child = 1465 scoped_refptr<LayerWithForcedDrawsContent> child =
1467 make_scoped_refptr(new LayerWithForcedDrawsContent()); 1466 make_scoped_refptr(new LayerWithForcedDrawsContent());
1468 1467
1469 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 1468 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 grand_child4->SetForceRenderSurface(true); 2158 grand_child4->SetForceRenderSurface(true);
2160 2159
2161 RenderSurfaceLayerList render_surface_layer_list; 2160 RenderSurfaceLayerList render_surface_layer_list;
2162 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( 2161 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
2163 parent.get(), parent->bounds(), &render_surface_layer_list); 2162 parent.get(), parent->bounds(), &render_surface_layer_list);
2164 inputs.can_adjust_raster_scales = true; 2163 inputs.can_adjust_raster_scales = true;
2165 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 2164 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
2166 ASSERT_TRUE(grand_child1->render_surface()); 2165 ASSERT_TRUE(grand_child1->render_surface());
2167 ASSERT_TRUE(grand_child2->render_surface()); 2166 ASSERT_TRUE(grand_child2->render_surface());
2168 ASSERT_TRUE(grand_child3->render_surface()); 2167 ASSERT_TRUE(grand_child3->render_surface());
2169 // Because grand_child4 is entirely clipped, it is expected to not have a
2170 // render surface.
2171 EXPECT_FALSE(grand_child4->render_surface());
2172 2168
2173 // Surfaces are clipped by their parent, but un-affected by the owning layer's 2169 // Surfaces are clipped by their parent, but un-affected by the owning layer's
2174 // masksToBounds. 2170 // masksToBounds.
2175 EXPECT_RECT_EQ(gfx::Rect(0, 0, 20, 20), 2171 EXPECT_RECT_EQ(gfx::Rect(0, 0, 20, 20),
2176 grand_child1->render_surface()->clip_rect()); 2172 grand_child1->render_surface()->clip_rect());
2177 EXPECT_RECT_EQ(gfx::Rect(0, 0, 20, 20), 2173 EXPECT_RECT_EQ(gfx::Rect(0, 0, 20, 20),
2178 grand_child2->render_surface()->clip_rect()); 2174 grand_child2->render_surface()->clip_rect());
2179 EXPECT_RECT_EQ(gfx::Rect(0, 0, 20, 20), 2175 EXPECT_RECT_EQ(gfx::Rect(0, 0, 20, 20),
2180 grand_child3->render_surface()->clip_rect()); 2176 grand_child3->render_surface()->clip_rect());
2181 } 2177 }
(...skipping 7892 matching lines...) Expand 10 before | Expand all | Expand 10 after
10074 10070
10075 // |grand_parent| has a transform that's neither a translation nor a scale. 10071 // |grand_parent| has a transform that's neither a translation nor a scale.
10076 EXPECT_EQ(0.f, grand_parent->last_maximum_animation_contents_scale()); 10072 EXPECT_EQ(0.f, grand_parent->last_maximum_animation_contents_scale());
10077 EXPECT_EQ(0.f, parent_raw->last_maximum_animation_contents_scale()); 10073 EXPECT_EQ(0.f, parent_raw->last_maximum_animation_contents_scale());
10078 EXPECT_EQ(0.f, child_raw->last_maximum_animation_contents_scale()); 10074 EXPECT_EQ(0.f, child_raw->last_maximum_animation_contents_scale());
10079 EXPECT_EQ(0.f, grand_child_raw->last_maximum_animation_contents_scale()); 10075 EXPECT_EQ(0.f, grand_child_raw->last_maximum_animation_contents_scale());
10080 } 10076 }
10081 10077
10082 } // namespace 10078 } // namespace
10083 } // namespace cc 10079 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_common.cc ('K') | « cc/trees/layer_tree_host_common.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698