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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 if (is_occlusion_immune) { | 315 if (is_occlusion_immune) { |
316 render_surface->SetNearestOcclusionImmuneAncestor(render_surface); | 316 render_surface->SetNearestOcclusionImmuneAncestor(render_surface); |
317 } else if (is_root) { | 317 } else if (is_root) { |
318 render_surface->SetNearestOcclusionImmuneAncestor(nullptr); | 318 render_surface->SetNearestOcclusionImmuneAncestor(nullptr); |
319 } else { | 319 } else { |
320 render_surface->SetNearestOcclusionImmuneAncestor( | 320 render_surface->SetNearestOcclusionImmuneAncestor( |
321 render_surface->render_target()->nearest_occlusion_immune_ancestor()); | 321 render_surface->render_target()->nearest_occlusion_immune_ancestor()); |
322 } | 322 } |
323 } | 323 } |
324 | 324 |
| 325 static bool SkipForInvertibility(const LayerImpl* layer, |
| 326 PropertyTrees* property_trees) { |
| 327 const TransformNode* transform_node = |
| 328 property_trees->transform_tree.Node(layer->transform_tree_index()); |
| 329 const EffectNode* effect_node = |
| 330 property_trees->effect_tree.Node(layer->effect_tree_index()); |
| 331 bool non_root_copy_request = |
| 332 effect_node->closest_ancestor_with_copy_request_id > |
| 333 EffectTree::kContentsRootNodeId; |
| 334 gfx::Transform from_target; |
| 335 // If there is a copy request, we check the invertibility of the transform |
| 336 // between the node corresponding to the layer and the node corresponding to |
| 337 // the copy request. Otherwise, we are interested in the invertibility of |
| 338 // screen space transform which is already cached on the transform node. |
| 339 return non_root_copy_request |
| 340 ? !property_trees->GetFromTarget( |
| 341 layer->transform_tree_index(), |
| 342 effect_node->closest_ancestor_with_copy_request_id, |
| 343 &from_target) |
| 344 : !transform_node->ancestors_are_invertible; |
| 345 } |
| 346 |
325 static void ComputeInitialRenderSurfaceList( | 347 static void ComputeInitialRenderSurfaceList( |
326 LayerTreeImpl* layer_tree_impl, | 348 LayerTreeImpl* layer_tree_impl, |
327 PropertyTrees* property_trees, | 349 PropertyTrees* property_trees, |
328 RenderSurfaceList* render_surface_list, | 350 RenderSurfaceList* render_surface_list, |
329 bool can_render_to_separate_surface) { | 351 bool can_render_to_separate_surface) { |
330 EffectTree& effect_tree = property_trees->effect_tree; | 352 EffectTree& effect_tree = property_trees->effect_tree; |
331 for (int i = EffectTree::kContentsRootNodeId; | 353 for (int i = EffectTree::kContentsRootNodeId; |
332 i < static_cast<int>(effect_tree.size()); ++i) { | 354 i < static_cast<int>(effect_tree.size()); ++i) { |
333 if (RenderSurfaceImpl* render_surface = effect_tree.GetRenderSurface(i)) { | 355 if (RenderSurfaceImpl* render_surface = effect_tree.GetRenderSurface(i)) { |
334 render_surface->set_is_render_surface_list_member(false); | 356 render_surface->set_is_render_surface_list_member(false); |
(...skipping 12 matching lines...) Expand all Loading... |
347 // surface's accumulated content rect. | 369 // surface's accumulated content rect. |
348 for (LayerImpl* layer : *layer_tree_impl) { | 370 for (LayerImpl* layer : *layer_tree_impl) { |
349 layer->set_contributes_to_drawn_render_surface(false); | 371 layer->set_contributes_to_drawn_render_surface(false); |
350 | 372 |
351 bool is_root = layer_tree_impl->IsRootLayer(layer); | 373 bool is_root = layer_tree_impl->IsRootLayer(layer); |
352 | 374 |
353 bool skip_draw_properties_computation = | 375 bool skip_draw_properties_computation = |
354 draw_property_utils::LayerShouldBeSkippedForDrawPropertiesComputation( | 376 draw_property_utils::LayerShouldBeSkippedForDrawPropertiesComputation( |
355 layer, property_trees->transform_tree, property_trees->effect_tree); | 377 layer, property_trees->transform_tree, property_trees->effect_tree); |
356 | 378 |
357 const TransformNode* transform_node = | 379 bool skip_for_invertibility = SkipForInvertibility(layer, property_trees); |
358 property_trees->transform_tree.Node(layer->transform_tree_index()); | |
359 bool skip_for_invertibility = !transform_node->ancestors_are_invertible; | |
360 | 380 |
361 bool skip_layer = !is_root && (skip_draw_properties_computation || | 381 bool skip_layer = !is_root && (skip_draw_properties_computation || |
362 skip_for_invertibility); | 382 skip_for_invertibility); |
363 | 383 |
364 layer->set_raster_even_if_not_in_rsll(skip_for_invertibility && | 384 layer->set_raster_even_if_not_in_rsll(skip_for_invertibility && |
365 !skip_draw_properties_computation); | 385 !skip_draw_properties_computation); |
366 if (skip_layer) | 386 if (skip_layer) |
367 continue; | 387 continue; |
368 | 388 |
369 bool layer_is_drawn = | 389 bool layer_is_drawn = |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 | 682 |
663 PropertyTrees* GetPropertyTrees(Layer* layer) { | 683 PropertyTrees* GetPropertyTrees(Layer* layer) { |
664 return layer->layer_tree_host()->property_trees(); | 684 return layer->layer_tree_host()->property_trees(); |
665 } | 685 } |
666 | 686 |
667 PropertyTrees* GetPropertyTrees(LayerImpl* layer) { | 687 PropertyTrees* GetPropertyTrees(LayerImpl* layer) { |
668 return layer->layer_tree_impl()->property_trees(); | 688 return layer->layer_tree_impl()->property_trees(); |
669 } | 689 } |
670 | 690 |
671 } // namespace cc | 691 } // namespace cc |
OLD | NEW |