| 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].get(); | 52 LayerImpl* child = root->children()[0]; |
| 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->DrawTransform(), SimpleEnclosedRegion(), | 59 Occlusion(child->DrawTransform(), 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].get(); | 105 LayerImpl* child = root->children()[0]; |
| 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 | 158 |
| 159 layer_tree_host()->SetRootLayer(root); | 159 layer_tree_host()->SetRootLayer(root); |
| 160 LayerTreeTest::SetupTree(); | 160 LayerTreeTest::SetupTree(); |
| 161 client_.set_bounds(root->bounds()); | 161 client_.set_bounds(root->bounds()); |
| 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].get(); | 168 LayerImpl* child = root->children()[0]; |
| 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->DrawTransform()); | 178 transform.PreconcatTransform(child->DrawTransform()); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 228 |
| 229 layer_tree_host()->SetRootLayer(root); | 229 layer_tree_host()->SetRootLayer(root); |
| 230 LayerTreeTest::SetupTree(); | 230 LayerTreeTest::SetupTree(); |
| 231 client_.set_bounds(root->bounds()); | 231 client_.set_bounds(root->bounds()); |
| 232 } | 232 } |
| 233 | 233 |
| 234 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 234 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 235 | 235 |
| 236 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 236 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
| 237 LayerImpl* root = impl->active_tree()->root_layer(); | 237 LayerImpl* root = impl->active_tree()->root_layer(); |
| 238 LayerImpl* child = root->children()[0].get(); | 238 LayerImpl* child = root->children()[0]; |
| 239 LayerImpl* mask = child->mask_layer(); | 239 LayerImpl* mask = child->mask_layer(); |
| 240 | 240 |
| 241 gfx::Transform scale; | 241 gfx::Transform scale; |
| 242 scale.Scale(2, 2); | 242 scale.Scale(2, 2); |
| 243 | 243 |
| 244 EXPECT_OCCLUSION_EQ( | 244 EXPECT_OCCLUSION_EQ( |
| 245 Occlusion(scale, SimpleEnclosedRegion(), | 245 Occlusion(scale, SimpleEnclosedRegion(), |
| 246 SimpleEnclosedRegion(gfx::Rect(13, 15, 10, 11))), | 246 SimpleEnclosedRegion(gfx::Rect(13, 15, 10, 11))), |
| 247 mask->draw_properties().occlusion_in_content_space); | 247 mask->draw_properties().occlusion_in_content_space); |
| 248 EndTest(); | 248 EndTest(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 | 295 |
| 296 layer_tree_host()->SetRootLayer(root); | 296 layer_tree_host()->SetRootLayer(root); |
| 297 LayerTreeTest::SetupTree(); | 297 LayerTreeTest::SetupTree(); |
| 298 client_.set_bounds(root->bounds()); | 298 client_.set_bounds(root->bounds()); |
| 299 } | 299 } |
| 300 | 300 |
| 301 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 301 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 302 | 302 |
| 303 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 303 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
| 304 LayerImpl* root = impl->active_tree()->root_layer(); | 304 LayerImpl* root = impl->active_tree()->root_layer(); |
| 305 LayerImpl* child = root->children()[0].get(); | 305 LayerImpl* child = root->children()[0]; |
| 306 RenderSurfaceImpl* surface = child->render_surface(); | 306 RenderSurfaceImpl* surface = child->render_surface(); |
| 307 LayerImpl* mask = child->mask_layer(); | 307 LayerImpl* mask = child->mask_layer(); |
| 308 | 308 |
| 309 // Verify the draw properties are valid. | 309 // Verify the draw properties are valid. |
| 310 EXPECT_TRUE(root->IsDrawnRenderSurfaceLayerListMember()); | 310 EXPECT_TRUE(root->IsDrawnRenderSurfaceLayerListMember()); |
| 311 EXPECT_TRUE(child->IsDrawnRenderSurfaceLayerListMember()); | 311 EXPECT_TRUE(child->IsDrawnRenderSurfaceLayerListMember()); |
| 312 EXPECT_EQ(child, child->render_target()); | 312 EXPECT_EQ(child, child->render_target()); |
| 313 | 313 |
| 314 // No occlusion from on child, which is part of the replica. | 314 // No occlusion from on child, which is part of the replica. |
| 315 EXPECT_OCCLUSION_EQ(Occlusion(), | 315 EXPECT_OCCLUSION_EQ(Occlusion(), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 328 void AfterTest() override {} | 328 void AfterTest() override {} |
| 329 | 329 |
| 330 FakeContentLayerClient client_; | 330 FakeContentLayerClient client_; |
| 331 }; | 331 }; |
| 332 | 332 |
| 333 SINGLE_AND_MULTI_THREAD_TEST_F( | 333 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 334 LayerTreeHostOcclusionTestDrawPropertiesInsideReplica); | 334 LayerTreeHostOcclusionTestDrawPropertiesInsideReplica); |
| 335 | 335 |
| 336 } // namespace | 336 } // namespace |
| 337 } // namespace cc | 337 } // namespace cc |
| OLD | NEW |