Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: cc/trees/draw_property_utils.cc

Issue 2873593002: Force use of and cache render surface. (Closed)
Patch Set: Rebased to resolve conflict. Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/damage_tracker_unittest.cc ('k') | cc/trees/effect_node.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 bool is_clipped; 550 bool is_clipped;
551 if (render_surface->EffectTreeIndex() == EffectTree::kContentsRootNodeId) { 551 if (render_surface->EffectTreeIndex() == EffectTree::kContentsRootNodeId) {
552 // Root render surface is always clipped. 552 // Root render surface is always clipped.
553 is_clipped = true; 553 is_clipped = true;
554 } else if (render_surface->has_contributing_layer_that_escapes_clip()) { 554 } else if (render_surface->has_contributing_layer_that_escapes_clip()) {
555 // We cannot clip a surface that has a contribuitng layer which escapes the 555 // We cannot clip a surface that has a contribuitng layer which escapes the
556 // clip. 556 // clip.
557 is_clipped = false; 557 is_clipped = false;
558 } else if (render_surface->ClipTreeIndex() == 558 } else if (render_surface->ClipTreeIndex() ==
559 render_surface->render_target()->ClipTreeIndex()) { 559 render_surface->render_target()->ClipTreeIndex()) {
560 // There is no clip between between the render surface and its target, so 560 // There is no clip between the render surface and its target, so
561 // the surface need not be clipped. 561 // the surface need not be clipped.
562 is_clipped = false; 562 is_clipped = false;
563 } else { 563 } else {
564 // If the clips between the render surface and its target only expand the 564 // If the clips between the render surface and its target only expand the
565 // clips and do not apply any new clip, we need not clip the render surface. 565 // clips and do not apply any new clip, we need not clip the render surface.
566 const ClipNode* clip_node = clip_tree.Node(render_surface->ClipTreeIndex()); 566 const ClipNode* clip_node = clip_tree.Node(render_surface->ClipTreeIndex());
567 is_clipped = clip_node->clip_type != ClipNode::ClipType::EXPANDS_CLIP; 567 is_clipped = clip_node->clip_type != ClipNode::ClipType::EXPANDS_CLIP;
568 } 568 }
569 render_surface->SetIsClipped(is_clipped); 569 render_surface->SetIsClipped(is_clipped);
570 } 570 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 &render_surface_transform); 659 &render_surface_transform);
660 660
661 ConcatInverseSurfaceContentsScale(effect_node, &render_surface_transform); 661 ConcatInverseSurfaceContentsScale(effect_node, &render_surface_transform);
662 render_surface->SetDrawTransform(render_surface_transform); 662 render_surface->SetDrawTransform(render_surface_transform);
663 } 663 }
664 664
665 static gfx::Rect LayerVisibleRect(PropertyTrees* property_trees, 665 static gfx::Rect LayerVisibleRect(PropertyTrees* property_trees,
666 LayerImpl* layer) { 666 LayerImpl* layer) {
667 const EffectNode* effect_node = 667 const EffectNode* effect_node =
668 property_trees->effect_tree.Node(layer->effect_tree_index()); 668 property_trees->effect_tree.Node(layer->effect_tree_index());
669 int effect_ancestor_with_cache_render_surface =
670 effect_node->closest_ancestor_with_cached_render_surface_id;
669 int effect_ancestor_with_copy_request = 671 int effect_ancestor_with_copy_request =
670 effect_node->closest_ancestor_with_copy_request_id; 672 effect_node->closest_ancestor_with_copy_request_id;
671 bool non_root_copy_request = 673 int lower_effect_closest_ancestor =
672 effect_ancestor_with_copy_request > EffectTree::kContentsRootNodeId; 674 std::max(effect_ancestor_with_cache_render_surface,
675 effect_ancestor_with_copy_request);
676 bool non_root_copy_request_or_cache_render_surface =
677 lower_effect_closest_ancestor > EffectTree::kContentsRootNodeId;
673 gfx::Rect layer_content_rect = gfx::Rect(layer->bounds()); 678 gfx::Rect layer_content_rect = gfx::Rect(layer->bounds());
674 gfx::RectF accumulated_clip_in_root_space; 679 gfx::RectF accumulated_clip_in_root_space;
675 if (non_root_copy_request) { 680 if (non_root_copy_request_or_cache_render_surface) {
676 bool include_expanding_clips = true; 681 bool include_expanding_clips = true;
677 ConditionalClip accumulated_clip = ComputeAccumulatedClip( 682 ConditionalClip accumulated_clip = ComputeAccumulatedClip(
678 property_trees, include_expanding_clips, layer->clip_tree_index(), 683 property_trees, include_expanding_clips, layer->clip_tree_index(),
679 effect_ancestor_with_copy_request); 684 lower_effect_closest_ancestor);
680 if (!accumulated_clip.is_clipped) 685 if (!accumulated_clip.is_clipped)
681 return layer_content_rect; 686 return layer_content_rect;
682 accumulated_clip_in_root_space = accumulated_clip.clip_rect; 687 accumulated_clip_in_root_space = accumulated_clip.clip_rect;
683 } else { 688 } else {
684 const ClipNode* clip_node = 689 const ClipNode* clip_node =
685 property_trees->clip_tree.Node(layer->clip_tree_index()); 690 property_trees->clip_tree.Node(layer->clip_tree_index());
686 accumulated_clip_in_root_space = 691 accumulated_clip_in_root_space =
687 clip_node->cached_accumulated_rect_in_screen_space; 692 clip_node->cached_accumulated_rect_in_screen_space;
688 } 693 }
689 694
690 const EffectNode* root_effect_node = 695 const EffectNode* root_effect_node =
691 non_root_copy_request 696 non_root_copy_request_or_cache_render_surface
692 ? property_trees->effect_tree.Node(effect_ancestor_with_copy_request) 697 ? property_trees->effect_tree.Node(lower_effect_closest_ancestor)
693 : property_trees->effect_tree.Node(EffectTree::kContentsRootNodeId); 698 : property_trees->effect_tree.Node(EffectTree::kContentsRootNodeId);
694 ConditionalClip accumulated_clip_in_layer_space = 699 ConditionalClip accumulated_clip_in_layer_space =
695 ComputeTargetRectInLocalSpace( 700 ComputeTargetRectInLocalSpace(
696 accumulated_clip_in_root_space, property_trees, 701 accumulated_clip_in_root_space, property_trees,
697 root_effect_node->transform_id, layer->transform_tree_index(), 702 root_effect_node->transform_id, layer->transform_tree_index(),
698 root_effect_node->id); 703 root_effect_node->id);
699 if (!accumulated_clip_in_layer_space.is_clipped) { 704 if (!accumulated_clip_in_layer_space.is_clipped) {
700 return layer_content_rect; 705 return layer_content_rect;
701 } 706 }
702 gfx::RectF clip_in_layer_space = accumulated_clip_in_layer_space.clip_rect; 707 gfx::RectF clip_in_layer_space = accumulated_clip_in_layer_space.clip_rect;
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 void UpdateElasticOverscroll(PropertyTrees* property_trees, 1057 void UpdateElasticOverscroll(PropertyTrees* property_trees,
1053 const Layer* overscroll_elasticity_layer, 1058 const Layer* overscroll_elasticity_layer,
1054 const gfx::Vector2dF& elastic_overscroll) { 1059 const gfx::Vector2dF& elastic_overscroll) {
1055 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, 1060 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer,
1056 elastic_overscroll); 1061 elastic_overscroll);
1057 } 1062 }
1058 1063
1059 } // namespace draw_property_utils 1064 } // namespace draw_property_utils
1060 1065
1061 } // namespace cc 1066 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/damage_tracker_unittest.cc ('k') | cc/trees/effect_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698