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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
555 bool is_clipped; | 555 bool is_clipped; |
556 if (render_surface->EffectTreeIndex() == EffectTree::kContentsRootNodeId) { | 556 if (render_surface->EffectTreeIndex() == EffectTree::kContentsRootNodeId) { |
557 // Root render surface is always clipped. | 557 // Root render surface is always clipped. |
558 is_clipped = true; | 558 is_clipped = true; |
559 } else if (render_surface->has_contributing_layer_that_escapes_clip()) { | 559 } else if (render_surface->has_contributing_layer_that_escapes_clip()) { |
560 // We cannot clip a surface that has a contribuitng layer which escapes the | 560 // We cannot clip a surface that has a contribuitng layer which escapes the |
561 // clip. | 561 // clip. |
562 is_clipped = false; | 562 is_clipped = false; |
563 } else if (render_surface->ClipTreeIndex() == | 563 } else if (render_surface->ClipTreeIndex() == |
564 render_surface->render_target()->ClipTreeIndex()) { | 564 render_surface->render_target()->ClipTreeIndex()) { |
565 // There is no clip between between the render surface and its target, so | 565 // There is no clip between the render surface and its target, so |
566 // the surface need not be clipped. | 566 // the surface need not be clipped. |
567 is_clipped = false; | 567 is_clipped = false; |
568 } else if (render_surface->ForceRenderSurface()) { | |
weiliangc
2017/06/07 21:19:01
I don't think this is where "force no clip" should
wutao
2017/06/09 02:31:33
Done.
| |
569 // Avoid clipping when force use of render surface. We might need the whole | |
570 // surface during some animations. | |
571 is_clipped = false; | |
568 } else { | 572 } else { |
569 // If the clips between the render surface and its target only expand the | 573 // If the clips between the render surface and its target only expand the |
570 // clips and do not apply any new clip, we need not clip the render surface. | 574 // clips and do not apply any new clip, we need not clip the render surface. |
571 const ClipNode* clip_node = clip_tree.Node(render_surface->ClipTreeIndex()); | 575 const ClipNode* clip_node = clip_tree.Node(render_surface->ClipTreeIndex()); |
572 is_clipped = clip_node->clip_type != ClipNode::ClipType::EXPANDS_CLIP; | 576 is_clipped = clip_node->clip_type != ClipNode::ClipType::EXPANDS_CLIP; |
573 } | 577 } |
574 render_surface->SetIsClipped(is_clipped); | 578 render_surface->SetIsClipped(is_clipped); |
575 } | 579 } |
576 | 580 |
577 static void SetSurfaceDrawOpacity(const EffectTree& tree, | 581 static void SetSurfaceDrawOpacity(const EffectTree& tree, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
662 effect_tree.Node(effect_node->target_id); | 666 effect_tree.Node(effect_node->target_id); |
663 property_trees->GetToTarget(transform_node->id, target_effect_node->id, | 667 property_trees->GetToTarget(transform_node->id, target_effect_node->id, |
664 &render_surface_transform); | 668 &render_surface_transform); |
665 | 669 |
666 ConcatInverseSurfaceContentsScale(effect_node, &render_surface_transform); | 670 ConcatInverseSurfaceContentsScale(effect_node, &render_surface_transform); |
667 render_surface->SetDrawTransform(render_surface_transform); | 671 render_surface->SetDrawTransform(render_surface_transform); |
668 } | 672 } |
669 | 673 |
670 static gfx::Rect LayerVisibleRect(PropertyTrees* property_trees, | 674 static gfx::Rect LayerVisibleRect(PropertyTrees* property_trees, |
671 LayerImpl* layer) { | 675 LayerImpl* layer) { |
672 const EffectNode* effect_node = | 676 const EffectNode* effect_node = |
weiliangc
2017/06/07 21:19:01
Force render surface will look like copy request:
wutao
2017/06/09 02:31:33
As discussed offline, will cache closest_ancestor_
| |
673 property_trees->effect_tree.Node(layer->effect_tree_index()); | 677 property_trees->effect_tree.Node(layer->effect_tree_index()); |
674 int effect_ancestor_with_copy_request = | 678 int effect_ancestor_with_copy_request = |
675 effect_node->closest_ancestor_with_copy_request_id; | 679 effect_node->closest_ancestor_with_copy_request_id; |
676 bool non_root_copy_request = | 680 bool non_root_copy_request = |
677 effect_ancestor_with_copy_request > EffectTree::kContentsRootNodeId; | 681 effect_ancestor_with_copy_request > EffectTree::kContentsRootNodeId; |
678 gfx::Rect layer_content_rect = gfx::Rect(layer->bounds()); | 682 gfx::Rect layer_content_rect = gfx::Rect(layer->bounds()); |
679 gfx::RectF accumulated_clip_in_root_space; | 683 gfx::RectF accumulated_clip_in_root_space; |
680 if (non_root_copy_request) { | 684 if (non_root_copy_request) { |
681 bool include_expanding_clips = true; | 685 bool include_expanding_clips = true; |
682 ConditionalClip accumulated_clip = ComputeAccumulatedClip( | 686 ConditionalClip accumulated_clip = ComputeAccumulatedClip( |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1070 void UpdateElasticOverscroll(PropertyTrees* property_trees, | 1074 void UpdateElasticOverscroll(PropertyTrees* property_trees, |
1071 const Layer* overscroll_elasticity_layer, | 1075 const Layer* overscroll_elasticity_layer, |
1072 const gfx::Vector2dF& elastic_overscroll) { | 1076 const gfx::Vector2dF& elastic_overscroll) { |
1073 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, | 1077 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, |
1074 elastic_overscroll); | 1078 elastic_overscroll); |
1075 } | 1079 } |
1076 | 1080 |
1077 } // namespace draw_property_utils | 1081 } // namespace draw_property_utils |
1078 | 1082 |
1079 } // namespace cc | 1083 } // namespace cc |
OLD | NEW |