| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/draw_property_utils.h" | 5 #include "cc/trees/draw_property_utils.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 bool is_clipped; | 556 bool is_clipped; |
| 557 if (render_surface->EffectTreeIndex() == EffectTree::kContentsRootNodeId) { | 557 if (render_surface->EffectTreeIndex() == EffectTree::kContentsRootNodeId) { |
| 558 // Root render surface is always clipped. | 558 // Root render surface is always clipped. |
| 559 is_clipped = true; | 559 is_clipped = true; |
| 560 } else if (render_surface->has_contributing_layer_that_escapes_clip()) { | 560 } else if (render_surface->has_contributing_layer_that_escapes_clip()) { |
| 561 // We cannot clip a surface that has a contribuitng layer which escapes the | 561 // We cannot clip a surface that has a contribuitng layer which escapes the |
| 562 // clip. | 562 // clip. |
| 563 is_clipped = false; | 563 is_clipped = false; |
| 564 } else if (render_surface->ClipTreeIndex() == | 564 } else if (render_surface->ClipTreeIndex() == |
| 565 render_surface->render_target()->ClipTreeIndex()) { | 565 render_surface->render_target()->ClipTreeIndex()) { |
| 566 // There is no clip between between the render surface and its target, so | 566 // There is no clip between the render surface and its target, so |
| 567 // the surface need not be clipped. | 567 // the surface need not be clipped. |
| 568 is_clipped = false; | 568 is_clipped = false; |
| 569 } else { | 569 } else { |
| 570 // If the clips between the render surface and its target only expand the | 570 // If the clips between the render surface and its target only expand the |
| 571 // clips and do not apply any new clip, we need not clip the render surface. | 571 // clips and do not apply any new clip, we need not clip the render surface. |
| 572 const ClipNode* clip_node = clip_tree.Node(render_surface->ClipTreeIndex()); | 572 const ClipNode* clip_node = clip_tree.Node(render_surface->ClipTreeIndex()); |
| 573 is_clipped = clip_node->clip_type != ClipNode::ClipType::EXPANDS_CLIP; | 573 is_clipped = clip_node->clip_type != ClipNode::ClipType::EXPANDS_CLIP; |
| 574 } | 574 } |
| 575 render_surface->SetIsClipped(is_clipped); | 575 render_surface->SetIsClipped(is_clipped); |
| 576 } | 576 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 &render_surface_transform); | 665 &render_surface_transform); |
| 666 | 666 |
| 667 ConcatInverseSurfaceContentsScale(effect_node, &render_surface_transform); | 667 ConcatInverseSurfaceContentsScale(effect_node, &render_surface_transform); |
| 668 render_surface->SetDrawTransform(render_surface_transform); | 668 render_surface->SetDrawTransform(render_surface_transform); |
| 669 } | 669 } |
| 670 | 670 |
| 671 static gfx::Rect LayerVisibleRect(PropertyTrees* property_trees, | 671 static gfx::Rect LayerVisibleRect(PropertyTrees* property_trees, |
| 672 LayerImpl* layer) { | 672 LayerImpl* layer) { |
| 673 const EffectNode* effect_node = | 673 const EffectNode* effect_node = |
| 674 property_trees->effect_tree.Node(layer->effect_tree_index()); | 674 property_trees->effect_tree.Node(layer->effect_tree_index()); |
| 675 int effect_ancestor_with_cache_render_surface = |
| 676 effect_node->closest_ancestor_with_cache_render_surface_id; |
| 675 int effect_ancestor_with_copy_request = | 677 int effect_ancestor_with_copy_request = |
| 676 effect_node->closest_ancestor_with_copy_request_id; | 678 effect_node->closest_ancestor_with_copy_request_id; |
| 677 bool non_root_copy_request = | 679 int lower_effect_closest_ancestor; |
| 678 effect_ancestor_with_copy_request > EffectTree::kContentsRootNodeId; | 680 if (effect_ancestor_with_cache_render_surface == EffectTree::kInvalidNodeId) { |
| 681 lower_effect_closest_ancestor = effect_ancestor_with_copy_request; |
| 682 } else if (effect_ancestor_with_copy_request == EffectTree::kInvalidNodeId) { |
| 683 lower_effect_closest_ancestor = effect_ancestor_with_cache_render_surface; |
| 684 } else { |
| 685 lower_effect_closest_ancestor = |
| 686 std::min(effect_ancestor_with_cache_render_surface, |
| 687 effect_ancestor_with_copy_request); |
| 688 } |
| 689 bool non_root_copy_request_or_cache_render_surface = |
| 690 lower_effect_closest_ancestor > EffectTree::kContentsRootNodeId; |
| 679 gfx::Rect layer_content_rect = gfx::Rect(layer->bounds()); | 691 gfx::Rect layer_content_rect = gfx::Rect(layer->bounds()); |
| 680 gfx::RectF accumulated_clip_in_root_space; | 692 gfx::RectF accumulated_clip_in_root_space; |
| 681 if (non_root_copy_request) { | 693 if (non_root_copy_request_or_cache_render_surface) { |
| 682 bool include_expanding_clips = true; | 694 bool include_expanding_clips = true; |
| 683 ConditionalClip accumulated_clip = ComputeAccumulatedClip( | 695 ConditionalClip accumulated_clip = ComputeAccumulatedClip( |
| 684 property_trees, include_expanding_clips, layer->clip_tree_index(), | 696 property_trees, include_expanding_clips, layer->clip_tree_index(), |
| 685 effect_ancestor_with_copy_request); | 697 lower_effect_closest_ancestor); |
| 686 if (!accumulated_clip.is_clipped) | 698 if (!accumulated_clip.is_clipped) |
| 687 return layer_content_rect; | 699 return layer_content_rect; |
| 688 accumulated_clip_in_root_space = accumulated_clip.clip_rect; | 700 accumulated_clip_in_root_space = accumulated_clip.clip_rect; |
| 689 } else { | 701 } else { |
| 690 const ClipNode* clip_node = | 702 const ClipNode* clip_node = |
| 691 property_trees->clip_tree.Node(layer->clip_tree_index()); | 703 property_trees->clip_tree.Node(layer->clip_tree_index()); |
| 692 accumulated_clip_in_root_space = | 704 accumulated_clip_in_root_space = |
| 693 clip_node->cached_accumulated_rect_in_screen_space; | 705 clip_node->cached_accumulated_rect_in_screen_space; |
| 694 } | 706 } |
| 695 | 707 |
| 696 const EffectNode* root_effect_node = | 708 const EffectNode* root_effect_node = |
| 697 non_root_copy_request | 709 non_root_copy_request_or_cache_render_surface |
| 698 ? property_trees->effect_tree.Node(effect_ancestor_with_copy_request) | 710 ? property_trees->effect_tree.Node(lower_effect_closest_ancestor) |
| 699 : property_trees->effect_tree.Node(EffectTree::kContentsRootNodeId); | 711 : property_trees->effect_tree.Node(EffectTree::kContentsRootNodeId); |
| 700 ConditionalClip accumulated_clip_in_layer_space = | 712 ConditionalClip accumulated_clip_in_layer_space = |
| 701 ComputeTargetRectInLocalSpace( | 713 ComputeTargetRectInLocalSpace( |
| 702 accumulated_clip_in_root_space, property_trees, | 714 accumulated_clip_in_root_space, property_trees, |
| 703 root_effect_node->transform_id, layer->transform_tree_index(), | 715 root_effect_node->transform_id, layer->transform_tree_index(), |
| 704 root_effect_node->id); | 716 root_effect_node->id); |
| 705 if (!accumulated_clip_in_layer_space.is_clipped) { | 717 if (!accumulated_clip_in_layer_space.is_clipped) { |
| 706 return layer_content_rect; | 718 return layer_content_rect; |
| 707 } | 719 } |
| 708 gfx::RectF clip_in_layer_space = accumulated_clip_in_layer_space.clip_rect; | 720 gfx::RectF clip_in_layer_space = accumulated_clip_in_layer_space.clip_rect; |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 void UpdateElasticOverscroll(PropertyTrees* property_trees, | 1090 void UpdateElasticOverscroll(PropertyTrees* property_trees, |
| 1079 const Layer* overscroll_elasticity_layer, | 1091 const Layer* overscroll_elasticity_layer, |
| 1080 const gfx::Vector2dF& elastic_overscroll) { | 1092 const gfx::Vector2dF& elastic_overscroll) { |
| 1081 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, | 1093 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, |
| 1082 elastic_overscroll); | 1094 elastic_overscroll); |
| 1083 } | 1095 } |
| 1084 | 1096 |
| 1085 } // namespace draw_property_utils | 1097 } // namespace draw_property_utils |
| 1086 | 1098 |
| 1087 } // namespace cc | 1099 } // namespace cc |
| OLD | NEW |