OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
8 #include "cc/layers/picture_layer.h" | 8 #include "cc/layers/picture_layer.h" |
9 #include "cc/test/fake_content_layer_client.h" | 9 #include "cc/test/fake_content_layer_client.h" |
10 #include "cc/test/layer_tree_test.h" | 10 #include "cc/test/layer_tree_test.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 root->AddChild(child); | 42 root->AddChild(child); |
43 | 43 |
44 layer_tree_host()->SetRootLayer(root); | 44 layer_tree_host()->SetRootLayer(root); |
45 LayerTreeTest::SetupTree(); | 45 LayerTreeTest::SetupTree(); |
46 } | 46 } |
47 | 47 |
48 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 48 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
49 | 49 |
50 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 50 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
51 LayerImpl* root = impl->active_tree()->root_layer(); | 51 LayerImpl* root = impl->active_tree()->root_layer(); |
52 LayerImpl* child = root->children()[0]; | 52 LayerImpl* child = root->children()[0].get(); |
53 | 53 |
54 // Verify the draw properties are valid. | 54 // Verify the draw properties are valid. |
55 EXPECT_TRUE(root->IsDrawnRenderSurfaceLayerListMember()); | 55 EXPECT_TRUE(root->IsDrawnRenderSurfaceLayerListMember()); |
56 EXPECT_TRUE(child->IsDrawnRenderSurfaceLayerListMember()); | 56 EXPECT_TRUE(child->IsDrawnRenderSurfaceLayerListMember()); |
57 | 57 |
58 EXPECT_OCCLUSION_EQ( | 58 EXPECT_OCCLUSION_EQ( |
59 Occlusion(child->draw_transform(), SimpleEnclosedRegion(), | 59 Occlusion(child->draw_transform(), SimpleEnclosedRegion(), |
60 SimpleEnclosedRegion()), | 60 SimpleEnclosedRegion()), |
61 child->draw_properties().occlusion_in_content_space); | 61 child->draw_properties().occlusion_in_content_space); |
62 EXPECT_OCCLUSION_EQ( | 62 EXPECT_OCCLUSION_EQ( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 root->AddChild(child2); | 95 root->AddChild(child2); |
96 | 96 |
97 layer_tree_host()->SetRootLayer(root); | 97 layer_tree_host()->SetRootLayer(root); |
98 LayerTreeTest::SetupTree(); | 98 LayerTreeTest::SetupTree(); |
99 } | 99 } |
100 | 100 |
101 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 101 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
102 | 102 |
103 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 103 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
104 LayerImpl* root = impl->active_tree()->root_layer(); | 104 LayerImpl* root = impl->active_tree()->root_layer(); |
105 LayerImpl* child = root->children()[0]; | 105 LayerImpl* child = root->children()[0].get(); |
106 RenderSurfaceImpl* surface = child->render_surface(); | 106 RenderSurfaceImpl* surface = child->render_surface(); |
107 | 107 |
108 // Verify the draw properties are valid. | 108 // Verify the draw properties are valid. |
109 EXPECT_TRUE(root->IsDrawnRenderSurfaceLayerListMember()); | 109 EXPECT_TRUE(root->IsDrawnRenderSurfaceLayerListMember()); |
110 EXPECT_TRUE(child->IsDrawnRenderSurfaceLayerListMember()); | 110 EXPECT_TRUE(child->IsDrawnRenderSurfaceLayerListMember()); |
111 EXPECT_EQ(child, child->render_target()); | 111 EXPECT_EQ(child, child->render_target()); |
112 | 112 |
113 EXPECT_OCCLUSION_EQ( | 113 EXPECT_OCCLUSION_EQ( |
114 Occlusion(surface->draw_transform(), SimpleEnclosedRegion(), | 114 Occlusion(surface->draw_transform(), SimpleEnclosedRegion(), |
115 SimpleEnclosedRegion(gfx::Rect(13, 9, 10, 11))), | 115 SimpleEnclosedRegion(gfx::Rect(13, 9, 10, 11))), |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 root->AddChild(child2); | 158 root->AddChild(child2); |
159 | 159 |
160 layer_tree_host()->SetRootLayer(root); | 160 layer_tree_host()->SetRootLayer(root); |
161 LayerTreeTest::SetupTree(); | 161 LayerTreeTest::SetupTree(); |
162 } | 162 } |
163 | 163 |
164 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 164 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
165 | 165 |
166 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 166 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
167 LayerImpl* root = impl->active_tree()->root_layer(); | 167 LayerImpl* root = impl->active_tree()->root_layer(); |
168 LayerImpl* child = root->children()[0]; | 168 LayerImpl* child = root->children()[0].get(); |
169 RenderSurfaceImpl* surface = child->render_surface(); | 169 RenderSurfaceImpl* surface = child->render_surface(); |
170 LayerImpl* mask = child->mask_layer(); | 170 LayerImpl* mask = child->mask_layer(); |
171 | 171 |
172 // Verify the draw properties are valid. | 172 // Verify the draw properties are valid. |
173 EXPECT_TRUE(root->IsDrawnRenderSurfaceLayerListMember()); | 173 EXPECT_TRUE(root->IsDrawnRenderSurfaceLayerListMember()); |
174 EXPECT_TRUE(child->IsDrawnRenderSurfaceLayerListMember()); | 174 EXPECT_TRUE(child->IsDrawnRenderSurfaceLayerListMember()); |
175 EXPECT_EQ(child, child->render_target()); | 175 EXPECT_EQ(child, child->render_target()); |
176 | 176 |
177 gfx::Transform transform = surface->draw_transform(); | 177 gfx::Transform transform = surface->draw_transform(); |
178 transform.PreconcatTransform(child->draw_transform()); | 178 transform.PreconcatTransform(child->draw_transform()); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 root->AddChild(child2); | 230 root->AddChild(child2); |
231 | 231 |
232 layer_tree_host()->SetRootLayer(root); | 232 layer_tree_host()->SetRootLayer(root); |
233 LayerTreeTest::SetupTree(); | 233 LayerTreeTest::SetupTree(); |
234 } | 234 } |
235 | 235 |
236 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 236 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
237 | 237 |
238 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 238 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
239 LayerImpl* root = impl->active_tree()->root_layer(); | 239 LayerImpl* root = impl->active_tree()->root_layer(); |
240 LayerImpl* child = root->children()[0]; | 240 LayerImpl* child = root->children()[0].get(); |
241 RenderSurfaceImpl* surface = child->render_surface(); | 241 RenderSurfaceImpl* surface = child->render_surface(); |
242 LayerImpl* mask = child->mask_layer(); | 242 LayerImpl* mask = child->mask_layer(); |
243 | 243 |
244 // Verify the draw properties are valid. | 244 // Verify the draw properties are valid. |
245 EXPECT_TRUE(root->IsDrawnRenderSurfaceLayerListMember()); | 245 EXPECT_TRUE(root->IsDrawnRenderSurfaceLayerListMember()); |
246 EXPECT_TRUE(child->IsDrawnRenderSurfaceLayerListMember()); | 246 EXPECT_TRUE(child->IsDrawnRenderSurfaceLayerListMember()); |
247 EXPECT_EQ(child, child->render_target()); | 247 EXPECT_EQ(child, child->render_target()); |
248 | 248 |
249 // No occlusion from on child, which is part of the replica. | 249 // No occlusion from on child, which is part of the replica. |
250 EXPECT_OCCLUSION_EQ(Occlusion(), | 250 EXPECT_OCCLUSION_EQ(Occlusion(), |
(...skipping 12 matching lines...) Expand all Loading... |
263 void AfterTest() override {} | 263 void AfterTest() override {} |
264 | 264 |
265 FakeContentLayerClient client_; | 265 FakeContentLayerClient client_; |
266 }; | 266 }; |
267 | 267 |
268 SINGLE_AND_MULTI_THREAD_TEST_F( | 268 SINGLE_AND_MULTI_THREAD_TEST_F( |
269 LayerTreeHostOcclusionTestDrawPropertiesInsideReplica); | 269 LayerTreeHostOcclusionTestDrawPropertiesInsideReplica); |
270 | 270 |
271 } // namespace | 271 } // namespace |
272 } // namespace cc | 272 } // namespace cc |
OLD | NEW |