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