OLD | NEW |
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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 return jitter; | 291 return jitter; |
292 } | 292 } |
293 | 293 |
294 enum PropertyTreeOption { | 294 enum PropertyTreeOption { |
295 BUILD_PROPERTY_TREES_IF_NEEDED, | 295 BUILD_PROPERTY_TREES_IF_NEEDED, |
296 DONT_BUILD_PROPERTY_TREES | 296 DONT_BUILD_PROPERTY_TREES |
297 }; | 297 }; |
298 | 298 |
299 static void ComputeLayerScrollsDrawnDescendants(LayerTreeImpl* layer_tree_impl, | 299 static void ComputeLayerScrollsDrawnDescendants(LayerTreeImpl* layer_tree_impl, |
300 ScrollTree* scroll_tree) { | 300 ScrollTree* scroll_tree) { |
301 for (int i = static_cast<int>(scroll_tree->size()) - 1; i > 0; --i) { | 301 for (int i = static_cast<int>(scroll_tree->size()) - 1; |
| 302 i > ScrollTree::kRootNodeId; --i) { |
302 ScrollNode* node = scroll_tree->Node(i); | 303 ScrollNode* node = scroll_tree->Node(i); |
303 scroll_tree->parent(node)->data.num_drawn_descendants += | 304 scroll_tree->parent(node)->data.num_drawn_descendants += |
304 node->data.num_drawn_descendants; | 305 node->data.num_drawn_descendants; |
305 } | 306 } |
306 for (LayerImpl* layer : *layer_tree_impl) { | 307 for (LayerImpl* layer : *layer_tree_impl) { |
307 bool scrolls_drawn_descendant = false; | 308 bool scrolls_drawn_descendant = false; |
308 if (layer->scrollable()) { | 309 if (layer->scrollable()) { |
309 ScrollNode* node = scroll_tree->Node(layer->scroll_tree_index()); | 310 ScrollNode* node = scroll_tree->Node(layer->scroll_tree_index()); |
310 if (node->data.num_drawn_descendants > 0) | 311 if (node->data.num_drawn_descendants > 0) |
311 scrolls_drawn_descendant = true; | 312 scrolls_drawn_descendant = true; |
312 } | 313 } |
313 layer->set_scrolls_drawn_descendant(scrolls_drawn_descendant); | 314 layer->set_scrolls_drawn_descendant(scrolls_drawn_descendant); |
314 } | 315 } |
315 } | 316 } |
316 | 317 |
317 static void ComputeInitialRenderSurfaceLayerList( | 318 static void ComputeInitialRenderSurfaceLayerList( |
318 LayerTreeImpl* layer_tree_impl, | 319 LayerTreeImpl* layer_tree_impl, |
319 PropertyTrees* property_trees, | 320 PropertyTrees* property_trees, |
320 LayerImplList* render_surface_layer_list, | 321 LayerImplList* render_surface_layer_list, |
321 bool can_render_to_separate_surface) { | 322 bool can_render_to_separate_surface) { |
322 ScrollTree* scroll_tree = &property_trees->scroll_tree; | 323 ScrollTree* scroll_tree = &property_trees->scroll_tree; |
323 for (int i = 0; i < static_cast<int>(scroll_tree->size()); ++i) | 324 for (int i = ScrollTree::kRootNodeId; |
| 325 i < static_cast<int>(scroll_tree->size()); ++i) |
324 scroll_tree->Node(i)->data.num_drawn_descendants = 0; | 326 scroll_tree->Node(i)->data.num_drawn_descendants = 0; |
325 | 327 |
326 // Add all non-skipped surfaces to the initial render surface layer list. Add | 328 // Add all non-skipped surfaces to the initial render surface layer list. Add |
327 // all non-skipped layers to the layer list of their target surface, and | 329 // all non-skipped layers to the layer list of their target surface, and |
328 // add their content rect to their target surface's accumulated content rect. | 330 // add their content rect to their target surface's accumulated content rect. |
329 for (LayerImpl* layer : *layer_tree_impl) { | 331 for (LayerImpl* layer : *layer_tree_impl) { |
330 if (layer->render_surface()) { | 332 if (layer->render_surface()) { |
331 layer->ClearRenderSurfaceLayerList(); | 333 layer->ClearRenderSurfaceLayerList(); |
332 ClearMaskLayersAreDrawnRenderSurfaceLayerListMembers( | 334 ClearMaskLayersAreDrawnRenderSurfaceLayerListMembers( |
333 layer->render_surface()); | 335 layer->render_surface()); |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 | 686 |
685 PropertyTrees* GetPropertyTrees(Layer* layer) { | 687 PropertyTrees* GetPropertyTrees(Layer* layer) { |
686 return layer->layer_tree_host()->property_trees(); | 688 return layer->layer_tree_host()->property_trees(); |
687 } | 689 } |
688 | 690 |
689 PropertyTrees* GetPropertyTrees(LayerImpl* layer) { | 691 PropertyTrees* GetPropertyTrees(LayerImpl* layer) { |
690 return layer->layer_tree_impl()->property_trees(); | 692 return layer->layer_tree_impl()->property_trees(); |
691 } | 693 } |
692 | 694 |
693 } // namespace cc | 695 } // namespace cc |
OLD | NEW |