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

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

Issue 1231453002: Compute if a layer is clipped outside CalcDrawProps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DrawProperties is_clipped removed Created 5 years, 5 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
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/property_tree_builder.h" 5 #include "cc/trees/property_tree_builder.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 template <typename LayerType> 94 template <typename LayerType>
95 void AddClipNodeIfNeeded(const DataForRecursion<LayerType>& data_from_ancestor, 95 void AddClipNodeIfNeeded(const DataForRecursion<LayerType>& data_from_ancestor,
96 LayerType* layer, 96 LayerType* layer,
97 bool created_transform_node, 97 bool created_transform_node,
98 DataForRecursion<LayerType>* data_for_children) { 98 DataForRecursion<LayerType>* data_for_children) {
99 ClipNode* parent = GetClipParent(data_from_ancestor, layer); 99 ClipNode* parent = GetClipParent(data_from_ancestor, layer);
100 int parent_id = parent->id; 100 int parent_id = parent->id;
101 101
102 bool ancestor_clips_subtree = 102 bool ancestor_clips_subtree =
103 data_from_ancestor.ancestor_clips_subtree || layer->clip_parent(); 103 data_from_ancestor.ancestor_clips_subtree ||
104 (layer->clip_parent() &&
105 layer->clip_parent()->is_clipped_from_property_tree());
ajuma 2015/07/09 14:50:15 This looks like a logic change (since we're now ch
jaydasika 2015/07/09 15:11:49 Yes. LayerTreeHostCommonTest.LayerTreeRebuildTest
104 106
105 data_for_children->ancestor_clips_subtree = false; 107 data_for_children->ancestor_clips_subtree = false;
106 bool has_unclipped_surface = false; 108 bool has_unclipped_surface = false;
107 109
108 if (layer->has_render_surface()) { 110 if (layer->has_render_surface()) {
109 if (ancestor_clips_subtree && layer->num_unclipped_descendants() > 0) 111 if (ancestor_clips_subtree && layer->num_unclipped_descendants() > 0)
110 data_for_children->ancestor_clips_subtree = true; 112 data_for_children->ancestor_clips_subtree = true;
111 else if (!ancestor_clips_subtree && !layer->num_unclipped_descendants()) 113 else if (!ancestor_clips_subtree && !layer->num_unclipped_descendants())
112 has_unclipped_surface = true; 114 has_unclipped_surface = true;
113 } else { 115 } else {
(...skipping 24 matching lines...) Expand all
138 data_for_children->render_target->transform_tree_index(); 140 data_for_children->render_target->transform_tree_index();
139 node.owner_id = layer->id(); 141 node.owner_id = layer->id();
140 142
141 data_for_children->clip_tree_parent = 143 data_for_children->clip_tree_parent =
142 data_for_children->clip_tree->Insert(node, parent_id); 144 data_for_children->clip_tree->Insert(node, parent_id);
143 } 145 }
144 146
145 layer->SetClipTreeIndex( 147 layer->SetClipTreeIndex(
146 has_unclipped_surface ? 0 : data_for_children->clip_tree_parent); 148 has_unclipped_surface ? 0 : data_for_children->clip_tree_parent);
147 149
150 layer->set_is_clipped_from_property_tree(
151 data_for_children->ancestor_clips_subtree);
152
148 // TODO(awoloszyn): Right now when we hit a node with a replica, we reset the 153 // TODO(awoloszyn): Right now when we hit a node with a replica, we reset the
149 // clip for all children since we may need to draw. We need to figure out a 154 // clip for all children since we may need to draw. We need to figure out a
150 // better way, since we will need both the clipped and unclipped versions. 155 // better way, since we will need both the clipped and unclipped versions.
151 } 156 }
152 157
153 template <typename LayerType> 158 template <typename LayerType>
154 bool AddTransformNodeIfNeeded( 159 bool AddTransformNodeIfNeeded(
155 const DataForRecursion<LayerType>& data_from_ancestor, 160 const DataForRecursion<LayerType>& data_from_ancestor,
156 LayerType* layer, 161 LayerType* layer,
157 DataForRecursion<LayerType>* data_for_children) { 162 DataForRecursion<LayerType>* data_for_children) {
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 const gfx::Rect& viewport, 502 const gfx::Rect& viewport,
498 const gfx::Transform& device_transform, 503 const gfx::Transform& device_transform,
499 PropertyTrees* property_trees) { 504 PropertyTrees* property_trees) {
500 BuildPropertyTreesTopLevelInternal( 505 BuildPropertyTreesTopLevelInternal(
501 root_layer, page_scale_layer, inner_viewport_scroll_layer, 506 root_layer, page_scale_layer, inner_viewport_scroll_layer,
502 outer_viewport_scroll_layer, page_scale_factor, device_scale_factor, 507 outer_viewport_scroll_layer, page_scale_factor, device_scale_factor,
503 viewport, device_transform, property_trees); 508 viewport, device_transform, property_trees);
504 } 509 }
505 510
506 } // namespace cc 511 } // namespace cc
OLDNEW
« cc/trees/layer_tree_impl_unittest.cc ('K') | « cc/trees/occlusion_tracker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698