| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_for_testing(); | 51 LayerImpl* root = impl->active_tree()->root_layer_for_testing(); |
| 52 LayerImpl* child = impl->active_tree()->LayerById(child_->id()); | 52 LayerImpl* child = impl->active_tree()->LayerById(child_->id()); |
| 53 | 53 |
| 54 // Verify the draw properties are valid. | 54 // Verify the draw properties are valid. |
| 55 EXPECT_TRUE(root->is_drawn_render_surface_layer_list_member()); | 55 EXPECT_TRUE(root->contributes_to_drawn_render_surface()); |
| 56 EXPECT_TRUE(child->is_drawn_render_surface_layer_list_member()); | 56 EXPECT_TRUE(child->contributes_to_drawn_render_surface()); |
| 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( |
| 63 Occlusion(root->DrawTransform(), SimpleEnclosedRegion(), | 63 Occlusion(root->DrawTransform(), SimpleEnclosedRegion(), |
| 64 SimpleEnclosedRegion(gfx::Rect(10, 6, 50, 59))), | 64 SimpleEnclosedRegion(gfx::Rect(10, 6, 50, 59))), |
| 65 root->draw_properties().occlusion_in_content_space); | 65 root->draw_properties().occlusion_in_content_space); |
| 66 EndTest(); | 66 EndTest(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 102 } |
| 103 | 103 |
| 104 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 104 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 105 | 105 |
| 106 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 106 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
| 107 LayerImpl* root = impl->active_tree()->root_layer_for_testing(); | 107 LayerImpl* root = impl->active_tree()->root_layer_for_testing(); |
| 108 LayerImpl* child = impl->active_tree()->LayerById(child_->id()); | 108 LayerImpl* child = impl->active_tree()->LayerById(child_->id()); |
| 109 RenderSurfaceImpl* surface = child->GetRenderSurface(); | 109 RenderSurfaceImpl* surface = child->GetRenderSurface(); |
| 110 | 110 |
| 111 // Verify the draw properties are valid. | 111 // Verify the draw properties are valid. |
| 112 EXPECT_TRUE(root->is_drawn_render_surface_layer_list_member()); | 112 EXPECT_TRUE(root->contributes_to_drawn_render_surface()); |
| 113 EXPECT_TRUE(child->is_drawn_render_surface_layer_list_member()); | 113 EXPECT_TRUE(child->contributes_to_drawn_render_surface()); |
| 114 EXPECT_TRUE(child->GetRenderSurface()); | 114 EXPECT_TRUE(child->GetRenderSurface()); |
| 115 EXPECT_EQ(child->GetRenderSurface(), child->render_target()); | 115 EXPECT_EQ(child->GetRenderSurface(), child->render_target()); |
| 116 | 116 |
| 117 EXPECT_OCCLUSION_EQ( | 117 EXPECT_OCCLUSION_EQ( |
| 118 Occlusion(surface->draw_transform(), SimpleEnclosedRegion(), | 118 Occlusion(surface->draw_transform(), SimpleEnclosedRegion(), |
| 119 SimpleEnclosedRegion(gfx::Rect(13, 9, 10, 11))), | 119 SimpleEnclosedRegion(gfx::Rect(13, 9, 10, 11))), |
| 120 surface->occlusion_in_content_space()); | 120 surface->occlusion_in_content_space()); |
| 121 EndTest(); | 121 EndTest(); |
| 122 } | 122 } |
| 123 | 123 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 171 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 172 | 172 |
| 173 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 173 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
| 174 LayerImpl* root = impl->active_tree()->root_layer_for_testing(); | 174 LayerImpl* root = impl->active_tree()->root_layer_for_testing(); |
| 175 LayerImpl* child = impl->active_tree()->LayerById(child_->id()); | 175 LayerImpl* child = impl->active_tree()->LayerById(child_->id()); |
| 176 RenderSurfaceImpl* surface = child->GetRenderSurface(); | 176 RenderSurfaceImpl* surface = child->GetRenderSurface(); |
| 177 LayerImpl* mask = surface->MaskLayer(); | 177 LayerImpl* mask = surface->MaskLayer(); |
| 178 | 178 |
| 179 // Verify the draw properties are valid. | 179 // Verify the draw properties are valid. |
| 180 EXPECT_TRUE(root->is_drawn_render_surface_layer_list_member()); | 180 EXPECT_TRUE(root->contributes_to_drawn_render_surface()); |
| 181 EXPECT_TRUE(child->is_drawn_render_surface_layer_list_member()); | 181 EXPECT_TRUE(child->contributes_to_drawn_render_surface()); |
| 182 EXPECT_TRUE(child->GetRenderSurface()); | 182 EXPECT_TRUE(child->GetRenderSurface()); |
| 183 EXPECT_EQ(child->GetRenderSurface(), child->render_target()); | 183 EXPECT_EQ(child->GetRenderSurface(), child->render_target()); |
| 184 | 184 |
| 185 gfx::Transform transform = surface->draw_transform(); | 185 gfx::Transform transform = surface->draw_transform(); |
| 186 transform.PreconcatTransform(child->DrawTransform()); | 186 transform.PreconcatTransform(child->DrawTransform()); |
| 187 | 187 |
| 188 EXPECT_OCCLUSION_EQ( | 188 EXPECT_OCCLUSION_EQ( |
| 189 Occlusion(transform, SimpleEnclosedRegion(), | 189 Occlusion(transform, SimpleEnclosedRegion(), |
| 190 SimpleEnclosedRegion(gfx::Rect(13, 9, 10, 11))), | 190 SimpleEnclosedRegion(gfx::Rect(13, 9, 10, 11))), |
| 191 mask->draw_properties().occlusion_in_content_space); | 191 mask->draw_properties().occlusion_in_content_space); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 private: | 262 private: |
| 263 FakeContentLayerClient client_; | 263 FakeContentLayerClient client_; |
| 264 scoped_refptr<Layer> child_; | 264 scoped_refptr<Layer> child_; |
| 265 }; | 265 }; |
| 266 | 266 |
| 267 SINGLE_AND_MULTI_THREAD_TEST_F( | 267 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 268 LayerTreeHostOcclusionTestDrawPropertiesOnScaledMask); | 268 LayerTreeHostOcclusionTestDrawPropertiesOnScaledMask); |
| 269 | 269 |
| 270 } // namespace | 270 } // namespace |
| 271 } // namespace cc | 271 } // namespace cc |
| OLD | NEW |