| 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/layers/layer_iterator.h" | 5 #include "cc/layers/layer_iterator.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
| 10 #include "cc/test/fake_layer_tree_host.h" | 10 #include "cc/test/fake_layer_tree_host.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 TestLayerImpl* first_ptr = first.get(); | 128 TestLayerImpl* first_ptr = first.get(); |
| 129 TestLayerImpl* second_ptr = second.get(); | 129 TestLayerImpl* second_ptr = second.get(); |
| 130 TestLayerImpl* third_ptr = third.get(); | 130 TestLayerImpl* third_ptr = third.get(); |
| 131 TestLayerImpl* fourth_ptr = fourth.get(); | 131 TestLayerImpl* fourth_ptr = fourth.get(); |
| 132 | 132 |
| 133 root_layer->AddChild(std::move(first)); | 133 root_layer->AddChild(std::move(first)); |
| 134 root_layer->AddChild(std::move(second)); | 134 root_layer->AddChild(std::move(second)); |
| 135 root_layer->AddChild(std::move(third)); | 135 root_layer->AddChild(std::move(third)); |
| 136 root_layer->AddChild(std::move(fourth)); | 136 root_layer->AddChild(std::move(fourth)); |
| 137 | 137 |
| 138 root_layer->SetHasRenderSurface(true); | |
| 139 host_impl_.active_tree()->SetRootLayer(std::move(root_layer)); | 138 host_impl_.active_tree()->SetRootLayer(std::move(root_layer)); |
| 140 | 139 |
| 141 LayerImplList render_surface_layer_list; | 140 LayerImplList render_surface_layer_list; |
| 142 host_impl_.active_tree()->IncrementRenderSurfaceListIdForTesting(); | 141 host_impl_.active_tree()->IncrementRenderSurfaceListIdForTesting(); |
| 143 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 142 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 144 root_ptr, root_ptr->bounds(), &render_surface_layer_list, | 143 root_ptr, root_ptr->bounds(), &render_surface_layer_list, |
| 145 host_impl_.active_tree()->current_render_surface_list_id()); | 144 host_impl_.active_tree()->current_render_surface_list_id()); |
| 146 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 145 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 147 | 146 |
| 148 IterateFrontToBack(&render_surface_layer_list); | 147 IterateFrontToBack(&render_surface_layer_list); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 176 | 175 |
| 177 root22->AddChild(std::move(root221)); | 176 root22->AddChild(std::move(root221)); |
| 178 root23->AddChild(std::move(root231)); | 177 root23->AddChild(std::move(root231)); |
| 179 root2->AddChild(std::move(root21)); | 178 root2->AddChild(std::move(root21)); |
| 180 root2->AddChild(std::move(root22)); | 179 root2->AddChild(std::move(root22)); |
| 181 root2->AddChild(std::move(root23)); | 180 root2->AddChild(std::move(root23)); |
| 182 root_layer->AddChild(std::move(root1)); | 181 root_layer->AddChild(std::move(root1)); |
| 183 root_layer->AddChild(std::move(root2)); | 182 root_layer->AddChild(std::move(root2)); |
| 184 root_layer->AddChild(std::move(root3)); | 183 root_layer->AddChild(std::move(root3)); |
| 185 | 184 |
| 186 root_layer->SetHasRenderSurface(true); | |
| 187 host_impl_.active_tree()->SetRootLayer(std::move(root_layer)); | 185 host_impl_.active_tree()->SetRootLayer(std::move(root_layer)); |
| 188 | 186 |
| 189 LayerImplList render_surface_layer_list; | 187 LayerImplList render_surface_layer_list; |
| 190 host_impl_.active_tree()->IncrementRenderSurfaceListIdForTesting(); | 188 host_impl_.active_tree()->IncrementRenderSurfaceListIdForTesting(); |
| 191 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 189 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 192 root_ptr, root_ptr->bounds(), &render_surface_layer_list, | 190 root_ptr, root_ptr->bounds(), &render_surface_layer_list, |
| 193 host_impl_.active_tree()->current_render_surface_list_id()); | 191 host_impl_.active_tree()->current_render_surface_list_id()); |
| 194 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 192 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 195 | 193 |
| 196 IterateFrontToBack(&render_surface_layer_list); | 194 IterateFrontToBack(&render_surface_layer_list); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 219 TestLayerImpl* root_ptr = root_layer.get(); | 217 TestLayerImpl* root_ptr = root_layer.get(); |
| 220 TestLayerImpl* root1_ptr = root1.get(); | 218 TestLayerImpl* root1_ptr = root1.get(); |
| 221 TestLayerImpl* root2_ptr = root2.get(); | 219 TestLayerImpl* root2_ptr = root2.get(); |
| 222 TestLayerImpl* root3_ptr = root3.get(); | 220 TestLayerImpl* root3_ptr = root3.get(); |
| 223 TestLayerImpl* root21_ptr = root21.get(); | 221 TestLayerImpl* root21_ptr = root21.get(); |
| 224 TestLayerImpl* root22_ptr = root22.get(); | 222 TestLayerImpl* root22_ptr = root22.get(); |
| 225 TestLayerImpl* root23_ptr = root23.get(); | 223 TestLayerImpl* root23_ptr = root23.get(); |
| 226 TestLayerImpl* root221_ptr = root221.get(); | 224 TestLayerImpl* root221_ptr = root221.get(); |
| 227 TestLayerImpl* root231_ptr = root231.get(); | 225 TestLayerImpl* root231_ptr = root231.get(); |
| 228 | 226 |
| 229 root22->SetHasRenderSurface(true); | 227 root22->SetForceRenderSurface(true); |
| 228 root23->SetForceRenderSurface(true); |
| 229 root2->SetForceRenderSurface(true); |
| 230 root22->AddChild(std::move(root221)); | 230 root22->AddChild(std::move(root221)); |
| 231 root23->SetHasRenderSurface(true); | |
| 232 root23->AddChild(std::move(root231)); | 231 root23->AddChild(std::move(root231)); |
| 233 root2->SetDrawsContent(false); | 232 root2->SetDrawsContent(false); |
| 234 root2->SetHasRenderSurface(true); | |
| 235 root2->AddChild(std::move(root21)); | 233 root2->AddChild(std::move(root21)); |
| 236 root2->AddChild(std::move(root22)); | 234 root2->AddChild(std::move(root22)); |
| 237 root2->AddChild(std::move(root23)); | 235 root2->AddChild(std::move(root23)); |
| 238 root_layer->AddChild(std::move(root1)); | 236 root_layer->AddChild(std::move(root1)); |
| 239 root_layer->AddChild(std::move(root2)); | 237 root_layer->AddChild(std::move(root2)); |
| 240 root_layer->AddChild(std::move(root3)); | 238 root_layer->AddChild(std::move(root3)); |
| 241 | 239 |
| 242 root_layer->SetHasRenderSurface(true); | |
| 243 host_impl_.active_tree()->SetRootLayer(std::move(root_layer)); | 240 host_impl_.active_tree()->SetRootLayer(std::move(root_layer)); |
| 244 | 241 |
| 245 LayerImplList render_surface_layer_list; | 242 LayerImplList render_surface_layer_list; |
| 246 host_impl_.active_tree()->IncrementRenderSurfaceListIdForTesting(); | 243 host_impl_.active_tree()->IncrementRenderSurfaceListIdForTesting(); |
| 247 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 244 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 248 root_ptr, root_ptr->bounds(), &render_surface_layer_list, | 245 root_ptr, root_ptr->bounds(), &render_surface_layer_list, |
| 249 host_impl_.active_tree()->current_render_surface_list_id()); | 246 host_impl_.active_tree()->current_render_surface_list_id()); |
| 250 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 247 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 251 | 248 |
| 252 IterateFrontToBack(&render_surface_layer_list); | 249 IterateFrontToBack(&render_surface_layer_list); |
| 253 EXPECT_COUNT(root_ptr, 14, -1, 13); | 250 EXPECT_COUNT(root_ptr, 14, -1, 13); |
| 254 EXPECT_COUNT(root1_ptr, -1, -1, 12); | 251 EXPECT_COUNT(root1_ptr, -1, -1, 12); |
| 255 EXPECT_COUNT(root2_ptr, 10, 11, -1); | 252 EXPECT_COUNT(root2_ptr, 10, 11, -1); |
| 256 EXPECT_COUNT(root21_ptr, -1, -1, 9); | 253 EXPECT_COUNT(root21_ptr, -1, -1, 9); |
| 257 EXPECT_COUNT(root22_ptr, 7, 8, 6); | 254 EXPECT_COUNT(root22_ptr, 7, 8, 6); |
| 258 EXPECT_COUNT(root221_ptr, -1, -1, 5); | 255 EXPECT_COUNT(root221_ptr, -1, -1, 5); |
| 259 EXPECT_COUNT(root23_ptr, 3, 4, 2); | 256 EXPECT_COUNT(root23_ptr, 3, 4, 2); |
| 260 EXPECT_COUNT(root231_ptr, -1, -1, 1); | 257 EXPECT_COUNT(root231_ptr, -1, -1, 1); |
| 261 EXPECT_COUNT(root3_ptr, -1, -1, 0); | 258 EXPECT_COUNT(root3_ptr, -1, -1, 0); |
| 262 } | 259 } |
| 263 | 260 |
| 264 } // namespace | 261 } // namespace |
| 265 } // namespace cc | 262 } // namespace cc |
| OLD | NEW |