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

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

Issue 2468113004: Revert of cc: Make visible rect computation aware of pixel-moving filters (Closed)
Patch Set: Created 4 years, 1 month 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/clip_node.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 ConcatInverseSurfaceContentsScale(target_effect_node, &target_to_local); 130 ConcatInverseSurfaceContentsScale(target_effect_node, &target_to_local);
131 131
132 if (target_transform_id > local_transform_id) 132 if (target_transform_id > local_transform_id)
133 return ConditionalClip{true, // is_clipped. 133 return ConditionalClip{true, // is_clipped.
134 MathUtil::MapClippedRect(target_to_local, rect)}; 134 MathUtil::MapClippedRect(target_to_local, rect)};
135 135
136 return ConditionalClip{true, // is_clipped. 136 return ConditionalClip{true, // is_clipped.
137 MathUtil::ProjectClippedRect(target_to_local, rect)}; 137 MathUtil::ProjectClippedRect(target_to_local, rect)};
138 } 138 }
139 139
140 static ConditionalClip ConvertRectBetweenSurfaceSpaces(
141 gfx::RectF rect,
142 const PropertyTrees* property_trees,
143 int source_transform_id,
144 int source_effect_id,
145 int dest_transform_id,
146 int dest_effect_id) {
147 gfx::Transform source_to_dest;
148 bool success = property_trees->GetToTarget(source_transform_id,
149 dest_effect_id, &source_to_dest);
150 if (!success)
151 return ConditionalClip{false, gfx::RectF()};
152 const EffectTree& effect_tree = property_trees->effect_tree;
153 const EffectNode* source_effect_node = effect_tree.Node(source_effect_id);
154 ConcatInverseSurfaceContentsScale(source_effect_node, &source_to_dest);
155 if (source_transform_id > dest_transform_id) {
156 return ConditionalClip{true, // is_clipped
157 MathUtil::MapClippedRect(source_to_dest, rect)};
158 }
159 return ConditionalClip{true, // is_clipped
160 MathUtil::ProjectClippedRect(source_to_dest, rect)};
161 }
162
163 static ConditionalClip ComputeLocalRectInTargetSpace( 140 static ConditionalClip ComputeLocalRectInTargetSpace(
164 gfx::RectF rect, 141 gfx::RectF rect,
165 const PropertyTrees* property_trees, 142 const PropertyTrees* property_trees,
166 int current_transform_id, 143 int current_transform_id,
167 int target_transform_id, 144 int target_transform_id,
168 int target_effect_id) { 145 int target_effect_id) {
169 gfx::Transform current_to_target; 146 gfx::Transform current_to_target;
170 if (!property_trees->GetToTarget(current_transform_id, target_effect_id, 147 if (!property_trees->GetToTarget(current_transform_id, target_effect_id,
171 &current_to_target)) { 148 &current_to_target)) {
172 // If transform is not invertible, cannot apply clip. 149 // If transform is not invertible, cannot apply clip.
(...skipping 19 matching lines...) Expand all
192 169
193 const EffectTree& effect_tree = property_trees->effect_tree; 170 const EffectTree& effect_tree = property_trees->effect_tree;
194 gfx::RectF current_clip = clip_node->clip; 171 gfx::RectF current_clip = clip_node->clip;
195 gfx::Vector2dF surface_contents_scale = 172 gfx::Vector2dF surface_contents_scale =
196 effect_tree.Node(target_effect_id)->surface_contents_scale; 173 effect_tree.Node(target_effect_id)->surface_contents_scale;
197 if (surface_contents_scale.x() > 0 && surface_contents_scale.y() > 0) 174 if (surface_contents_scale.x() > 0 && surface_contents_scale.y() > 0)
198 current_clip.Scale(surface_contents_scale.x(), surface_contents_scale.y()); 175 current_clip.Scale(surface_contents_scale.x(), surface_contents_scale.y());
199 return ConditionalClip{true /* is_clipped */, current_clip}; 176 return ConditionalClip{true /* is_clipped */, current_clip};
200 } 177 }
201 178
202 static bool ApplyClipNodeToAccumulatedClip(const PropertyTrees* property_trees,
203 bool include_expanding_clips,
204 int target_id,
205 int target_transform_id,
206 const ClipNode* clip_node,
207 gfx::RectF* accumulated_clip) {
208 switch (clip_node->clip_type) {
209 case ClipNode::ClipType::APPLIES_LOCAL_CLIP: {
210 ConditionalClip current_clip = ComputeCurrentClip(
211 clip_node, property_trees, target_transform_id, target_id);
212
213 // If transform is not invertible, no clip will be applied.
214 if (!current_clip.is_clipped)
215 return false;
216
217 *accumulated_clip =
218 gfx::IntersectRects(*accumulated_clip, current_clip.clip_rect);
219 return true;
220 }
221 case ClipNode::ClipType::EXPANDS_CLIP: {
222 if (!include_expanding_clips)
223 return true;
224
225 // Bring the accumulated clip to the space of the expanding effect.
226 const EffectNode* expanding_effect_node =
227 property_trees->effect_tree.Node(
228 clip_node->clip_expander->target_effect_id());
229 ConditionalClip accumulated_clip_in_expanding_space =
230 ConvertRectBetweenSurfaceSpaces(
231 *accumulated_clip, property_trees, target_transform_id, target_id,
232 expanding_effect_node->transform_id, expanding_effect_node->id);
233 // If transform is not invertible, no clip will be applied.
234 if (!accumulated_clip_in_expanding_space.is_clipped)
235 return false;
236
237 // Do the expansion.
238 gfx::RectF expanded_clip_in_expanding_space =
239 gfx::RectF(clip_node->clip_expander->MapRectReverse(
240 gfx::ToEnclosingRect(
241 accumulated_clip_in_expanding_space.clip_rect),
242 property_trees));
243
244 // Put the expanded clip back into the original target space.
245 ConditionalClip expanded_clip_in_target_space =
246 ConvertRectBetweenSurfaceSpaces(
247 expanded_clip_in_expanding_space, property_trees,
248 expanding_effect_node->transform_id, expanding_effect_node->id,
249 target_transform_id, target_id);
250 // If transform is not invertible, no clip will be applied.
251 if (!expanded_clip_in_target_space.is_clipped)
252 return false;
253 *accumulated_clip = expanded_clip_in_target_space.clip_rect;
254 return true;
255 }
256 case ClipNode::ClipType::NONE:
257 return true;
258 }
259 NOTREACHED();
260 return true;
261 }
262
263 static ConditionalClip ComputeAccumulatedClip( 179 static ConditionalClip ComputeAccumulatedClip(
264 const PropertyTrees* property_trees, 180 const PropertyTrees* property_trees,
265 bool include_viewport_clip, 181 bool include_viewport_clip,
266 bool include_expanding_clips,
267 int local_clip_id, 182 int local_clip_id,
268 int target_id) { 183 int target_id) {
269 DCHECK(!include_viewport_clip || 184 DCHECK(!include_viewport_clip ||
270 target_id == EffectTree::kContentsRootNodeId); 185 target_id == EffectTree::kContentsRootNodeId);
271 const ClipTree& clip_tree = property_trees->clip_tree; 186 const ClipTree& clip_tree = property_trees->clip_tree;
272 const EffectTree& effect_tree = property_trees->effect_tree; 187 const EffectTree& effect_tree = property_trees->effect_tree;
273 188
274 const ClipNode* clip_node = clip_tree.Node(local_clip_id); 189 const ClipNode* clip_node = clip_tree.Node(local_clip_id);
275 const EffectNode* target_node = effect_tree.Node(target_id); 190 const EffectNode* target_node = effect_tree.Node(target_id);
276 int target_transform_id = target_node->transform_id; 191 int target_transform_id = target_node->transform_id;
192 bool is_clipped = false;
277 193
278 // Collect all the clips that need to be accumulated. 194 // Collect all the clips that need to be accumulated.
279 std::stack<const ClipNode*> parent_chain; 195 std::stack<const ClipNode*> parent_chain;
280 196
281 // If target is not direct ancestor of clip, this will find least common 197 // If target is not direct ancestor of clip, this will find least common
282 // ancestor between the target and the clip. 198 // ancestor between the target and the clip.
283 while (target_node->clip_id > clip_node->id || 199 while (target_node->clip_id > clip_node->id ||
284 target_node->has_unclipped_descendants) { 200 target_node->has_unclipped_descendants) {
285 target_node = effect_tree.Node(target_node->target_id); 201 target_node = effect_tree.Node(target_node->target_id);
286 } 202 }
287 203
288 // Collect clip nodes up to the least common ancestor. 204 // Collect clip nodes up to the least common ancestor.
289 while (target_node->clip_id < clip_node->id) { 205 while (target_node->clip_id < clip_node->id) {
290 parent_chain.push(clip_node); 206 parent_chain.push(clip_node);
291 clip_node = clip_tree.parent(clip_node); 207 clip_node = clip_tree.parent(clip_node);
292 } 208 }
293 DCHECK_EQ(target_node->clip_id, clip_node->id); 209 DCHECK_EQ(target_node->clip_id, clip_node->id);
294 210
295 if (!include_viewport_clip && parent_chain.size() == 0) { 211 if (!include_viewport_clip && parent_chain.size() == 0) {
296 // There aren't any clips to apply. 212 // There aren't any clips to apply.
297 return ConditionalClip{false, gfx::RectF()}; 213 return ConditionalClip{false, gfx::RectF()};
298 } 214 }
299 215
300 if (!include_viewport_clip) { 216 if (!include_viewport_clip) {
301 clip_node = parent_chain.top(); 217 clip_node = parent_chain.top();
302 parent_chain.pop(); 218 parent_chain.pop();
303 } 219 }
304 220
305 // Find the first clip in the chain that we need to apply. 221 // TODO(weiliangc): If we don't create clip for render surface, we don't need
222 // to check applies_local_clip.
306 while (clip_node->clip_type != ClipNode::ClipType::APPLIES_LOCAL_CLIP && 223 while (clip_node->clip_type != ClipNode::ClipType::APPLIES_LOCAL_CLIP &&
307 parent_chain.size() > 0) { 224 parent_chain.size() > 0) {
308 clip_node = parent_chain.top(); 225 clip_node = parent_chain.top();
309 parent_chain.pop(); 226 parent_chain.pop();
310 } 227 }
311 228
312 if (clip_node->clip_type != ClipNode::ClipType::APPLIES_LOCAL_CLIP) { 229 if (clip_node->clip_type != ClipNode::ClipType::APPLIES_LOCAL_CLIP)
313 // No clip node applying clip in between. 230 // No clip node applying clip in between.
314 return ConditionalClip{false, gfx::RectF()}; 231 return ConditionalClip{false, gfx::RectF()};
315 }
316 232
317 ConditionalClip current_clip = ComputeCurrentClip( 233 ConditionalClip current_clip = ComputeCurrentClip(
318 clip_node, property_trees, target_transform_id, target_id); 234 clip_node, property_trees, target_transform_id, target_id);
319 235 is_clipped = current_clip.is_clipped;
320 // If transform is not invertible, no clip will be applied.
321 if (!current_clip.is_clipped)
322 return ConditionalClip{false, gfx::RectF()};
323 gfx::RectF accumulated_clip = current_clip.clip_rect; 236 gfx::RectF accumulated_clip = current_clip.clip_rect;
324 237
325 while (parent_chain.size() > 0) { 238 while (parent_chain.size() > 0) {
326 clip_node = parent_chain.top(); 239 clip_node = parent_chain.top();
327 parent_chain.pop(); 240 parent_chain.pop();
328 bool success = ApplyClipNodeToAccumulatedClip( 241 if (clip_node->clip_type != ClipNode::ClipType::APPLIES_LOCAL_CLIP) {
329 property_trees, include_expanding_clips, target_id, target_transform_id, 242 continue;
330 clip_node, &accumulated_clip); 243 }
244 ConditionalClip current_clip = ComputeCurrentClip(
245 clip_node, property_trees, target_transform_id, target_id);
331 246
332 // Failure to apply the clip means we encountered an uninvertible transform, 247 // If transform is not invertible, no clip will be applied.
333 // so no clip will be applied. 248 if (!current_clip.is_clipped)
334 if (!success) 249 return ConditionalClip{false, gfx::RectF()};
335 return ConditionalClip{false /* is_clipped */, gfx::RectF()}; 250
251 is_clipped = true;
252 accumulated_clip =
253 gfx::IntersectRects(accumulated_clip, current_clip.clip_rect);
336 } 254 }
337 255
338 return ConditionalClip{true /* is_clipped */, accumulated_clip.IsEmpty() 256 return ConditionalClip{
339 ? gfx::RectF() 257 is_clipped, accumulated_clip.IsEmpty() ? gfx::RectF() : accumulated_clip};
340 : accumulated_clip};
341 } 258 }
342 259
343 static gfx::RectF ComputeAccumulatedClipInRootSpaceForVisibleRect( 260 static gfx::RectF ComputeAccumulatedClipInRootSpaceForVisibleRect(
344 const PropertyTrees* property_trees, 261 const PropertyTrees* property_trees,
345 int local_clip_id) { 262 int local_clip_id) {
346 const int root_effect_id = EffectTree::kContentsRootNodeId; 263 const int root_effect_id = EffectTree::kContentsRootNodeId;
347 bool include_viewport_clip = true; 264 bool include_viewport_clip = true;
348 bool include_expanding_clips = true;
349 ConditionalClip accumulated_clip = ComputeAccumulatedClip( 265 ConditionalClip accumulated_clip = ComputeAccumulatedClip(
350 property_trees, include_viewport_clip, include_expanding_clips, 266 property_trees, include_viewport_clip, local_clip_id, root_effect_id);
351 local_clip_id, root_effect_id);
352 DCHECK(accumulated_clip.is_clipped); 267 DCHECK(accumulated_clip.is_clipped);
353 return accumulated_clip.clip_rect; 268 return accumulated_clip.clip_rect;
354 } 269 }
355 270
356 void CalculateClipRects(const std::vector<LayerImpl*>& visible_layer_list, 271 void CalculateClipRects(const std::vector<LayerImpl*>& visible_layer_list,
357 const PropertyTrees* property_trees, 272 const PropertyTrees* property_trees,
358 bool non_root_surfaces_enabled) { 273 bool non_root_surfaces_enabled) {
359 const ClipTree& clip_tree = property_trees->clip_tree; 274 const ClipTree& clip_tree = property_trees->clip_tree;
360 for (auto& layer : visible_layer_list) { 275 for (auto& layer : visible_layer_list) {
361 const ClipNode* clip_node = clip_tree.Node(layer->clip_tree_index()); 276 const ClipNode* clip_node = clip_tree.Node(layer->clip_tree_index());
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 const TransformTree& transform_tree = property_trees->transform_tree; 328 const TransformTree& transform_tree = property_trees->transform_tree;
414 const ClipTree& clip_tree = property_trees->clip_tree; 329 const ClipTree& clip_tree = property_trees->clip_tree;
415 for (auto& layer : visible_layer_list) { 330 for (auto& layer : visible_layer_list) {
416 gfx::Size layer_bounds = layer->bounds(); 331 gfx::Size layer_bounds = layer->bounds();
417 332
418 int effect_ancestor_with_copy_request = 333 int effect_ancestor_with_copy_request =
419 effect_tree.ClosestAncestorWithCopyRequest(layer->effect_tree_index()); 334 effect_tree.ClosestAncestorWithCopyRequest(layer->effect_tree_index());
420 if (effect_ancestor_with_copy_request > 1) { 335 if (effect_ancestor_with_copy_request > 1) {
421 // Non root copy request. 336 // Non root copy request.
422 bool include_viewport_clip = false; 337 bool include_viewport_clip = false;
423 bool include_expanding_clips = true;
424 ConditionalClip accumulated_clip_rect = ComputeAccumulatedClip( 338 ConditionalClip accumulated_clip_rect = ComputeAccumulatedClip(
425 property_trees, include_viewport_clip, include_expanding_clips, 339 property_trees, include_viewport_clip, layer->clip_tree_index(),
426 layer->clip_tree_index(), effect_ancestor_with_copy_request); 340 effect_ancestor_with_copy_request);
427 if (!accumulated_clip_rect.is_clipped) { 341 if (!accumulated_clip_rect.is_clipped) {
428 layer->set_visible_layer_rect(gfx::Rect(layer_bounds)); 342 layer->set_visible_layer_rect(gfx::Rect(layer_bounds));
429 continue; 343 continue;
430 } 344 }
431 345
432 gfx::RectF accumulated_clip_in_copy_request_space = 346 gfx::RectF accumulated_clip_in_copy_request_space =
433 accumulated_clip_rect.clip_rect; 347 accumulated_clip_rect.clip_rect;
434 348
435 const EffectNode* copy_request_effect_node = 349 const EffectNode* copy_request_effect_node =
436 effect_tree.Node(effect_ancestor_with_copy_request); 350 effect_tree.Node(effect_ancestor_with_copy_request);
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 ConcatInverseSurfaceContentsScale(parent_target_effect_node, 791 ConcatInverseSurfaceContentsScale(parent_target_effect_node,
878 &parent_to_current); 792 &parent_to_current);
879 } 793 }
880 // If we can't compute a transform, it's because we had to use the inverse 794 // If we can't compute a transform, it's because we had to use the inverse
881 // of a singular transform. We won't draw in this case, so there's no need 795 // of a singular transform. We won't draw in this case, so there's no need
882 // to compute clips. 796 // to compute clips.
883 if (!success) 797 if (!success)
884 continue; 798 continue;
885 parent_combined_clip_in_target_space = MathUtil::ProjectClippedRect( 799 parent_combined_clip_in_target_space = MathUtil::ProjectClippedRect(
886 parent_to_current, parent_clip_node->combined_clip_in_target_space); 800 parent_to_current, parent_clip_node->combined_clip_in_target_space);
887 if (clip_node->clip_type == ClipNode::ClipType::EXPANDS_CLIP) {
888 parent_combined_clip_in_target_space =
889 gfx::RectF(clip_node->clip_expander->MapRectReverse(
890 gfx::ToEnclosingRect(parent_combined_clip_in_target_space),
891 property_trees));
892 }
893 parent_clip_in_target_space = MathUtil::ProjectClippedRect( 801 parent_clip_in_target_space = MathUtil::ProjectClippedRect(
894 parent_to_current, parent_clip_node->clip_in_target_space); 802 parent_to_current, parent_clip_node->clip_in_target_space);
895 } 803 }
896 // Only nodes affected by ancestor clips will have their clip adjusted due 804 // Only nodes affected by ancestor clips will have their clip adjusted due
897 // to intersecting with an ancestor clip. But, we still need to propagate 805 // to intersecting with an ancestor clip. But, we still need to propagate
898 // the combined clip to our children because if they are clipped, they may 806 // the combined clip to our children because if they are clipped, they may
899 // need to clip using our parent clip and if we don't propagate it here, 807 // need to clip using our parent clip and if we don't propagate it here,
900 // it will be lost. 808 // it will be lost.
901 if (clip_node->resets_clip && non_root_surfaces_enabled) { 809 if (clip_node->resets_clip && non_root_surfaces_enabled) {
902 if (clip_node->clip_type == ClipNode::ClipType::APPLIES_LOCAL_CLIP) { 810 if (clip_node->clip_type == ClipNode::ClipType::APPLIES_LOCAL_CLIP) {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 gfx::ToEnclosingRect(clip_tree->Node(root_effect_node->clip_id)->clip); 929 gfx::ToEnclosingRect(clip_tree->Node(root_effect_node->clip_id)->clip);
1022 if (root_render_surface->is_clipped()) 930 if (root_render_surface->is_clipped())
1023 DCHECK(root_clip == root_render_surface->clip_rect()) 931 DCHECK(root_clip == root_render_surface->clip_rect())
1024 << "clip on root render surface: " 932 << "clip on root render surface: "
1025 << root_render_surface->clip_rect().ToString() 933 << root_render_surface->clip_rect().ToString()
1026 << " v.s. root effect node's clip: " << root_clip.ToString(); 934 << " v.s. root effect node's clip: " << root_clip.ToString();
1027 for (int i = 2; i < static_cast<int>(effect_tree->size()); ++i) { 935 for (int i = 2; i < static_cast<int>(effect_tree->size()); ++i) {
1028 EffectNode* effect_node = effect_tree->Node(i); 936 EffectNode* effect_node = effect_tree->Node(i);
1029 const EffectNode* target_node = effect_tree->Node(effect_node->target_id); 937 const EffectNode* target_node = effect_tree->Node(effect_node->target_id);
1030 bool include_viewport_clip = false; 938 bool include_viewport_clip = false;
1031 bool include_expanding_clips = false; 939 ConditionalClip accumulated_clip_rect =
1032 ConditionalClip accumulated_clip_rect = ComputeAccumulatedClip( 940 ComputeAccumulatedClip(property_trees, include_viewport_clip,
1033 property_trees, include_viewport_clip, include_expanding_clips, 941 effect_node->clip_id, target_node->id);
1034 effect_node->clip_id, target_node->id);
1035 gfx::RectF accumulated_clip = accumulated_clip_rect.clip_rect; 942 gfx::RectF accumulated_clip = accumulated_clip_rect.clip_rect;
1036 const RenderSurfaceImpl* render_surface = effect_node->render_surface; 943 const RenderSurfaceImpl* render_surface = effect_node->render_surface;
1037 if (render_surface && render_surface->is_clipped()) { 944 if (render_surface && render_surface->is_clipped()) {
1038 DCHECK(gfx::ToEnclosingRect(accumulated_clip) == 945 DCHECK(gfx::ToEnclosingRect(accumulated_clip) ==
1039 render_surface->clip_rect()) 946 render_surface->clip_rect())
1040 << " render surface's clip rect: " 947 << " render surface's clip rect: "
1041 << render_surface->clip_rect().ToString() 948 << render_surface->clip_rect().ToString()
1042 << " v.s. accumulated clip: " 949 << " v.s. accumulated clip: "
1043 << gfx::ToEnclosingRect(accumulated_clip).ToString(); 950 << gfx::ToEnclosingRect(accumulated_clip).ToString();
1044 } 951 }
1045 } 952 }
1046 } 953 }
1047 954
1048 static void ComputeLayerClipRect(const PropertyTrees* property_trees, 955 static void ComputeLayerClipRect(const PropertyTrees* property_trees,
1049 const LayerImpl* layer) { 956 const LayerImpl* layer) {
1050 const EffectTree* effect_tree = &property_trees->effect_tree; 957 const EffectTree* effect_tree = &property_trees->effect_tree;
1051 const ClipTree* clip_tree = &property_trees->clip_tree; 958 const ClipTree* clip_tree = &property_trees->clip_tree;
1052 const EffectNode* effect_node = effect_tree->Node(layer->effect_tree_index()); 959 const EffectNode* effect_node = effect_tree->Node(layer->effect_tree_index());
1053 const EffectNode* target_node = 960 const EffectNode* target_node =
1054 effect_node->has_render_surface 961 effect_node->has_render_surface
1055 ? effect_node 962 ? effect_node
1056 : effect_tree->Node(effect_node->target_id); 963 : effect_tree->Node(effect_node->target_id);
1057 // TODO(weiliangc): When effect node has up to date render surface info on 964 // TODO(weiliangc): When effect node has up to date render surface info on
1058 // compositor thread, no need to check for resourceless draw mode 965 // compositor thread, no need to check for resourceless draw mode
1059 if (!property_trees->non_root_surfaces_enabled) { 966 if (!property_trees->non_root_surfaces_enabled) {
1060 target_node = effect_tree->Node(1); 967 target_node = effect_tree->Node(1);
1061 } 968 }
1062 969
1063 bool include_viewport_clip = false; 970 bool include_viewport_clip = false;
1064 bool include_expanding_clips = false; 971 ConditionalClip accumulated_clip_rect =
1065 ConditionalClip accumulated_clip_rect = ComputeAccumulatedClip( 972 ComputeAccumulatedClip(property_trees, include_viewport_clip,
1066 property_trees, include_viewport_clip, include_expanding_clips, 973 layer->clip_tree_index(), target_node->id);
1067 layer->clip_tree_index(), target_node->id);
1068 974
1069 gfx::RectF accumulated_clip = accumulated_clip_rect.clip_rect; 975 gfx::RectF accumulated_clip = accumulated_clip_rect.clip_rect;
1070 976
1071 if ((!property_trees->non_root_surfaces_enabled && 977 if ((!property_trees->non_root_surfaces_enabled &&
1072 clip_tree->Node(layer->clip_tree_index()) 978 clip_tree->Node(layer->clip_tree_index())
1073 ->layers_are_clipped_when_surfaces_disabled) || 979 ->layers_are_clipped_when_surfaces_disabled) ||
1074 clip_tree->Node(layer->clip_tree_index())->layers_are_clipped) { 980 clip_tree->Node(layer->clip_tree_index())->layers_are_clipped) {
1075 DCHECK(layer->clip_rect() == gfx::ToEnclosingRect(accumulated_clip)) 981 DCHECK(layer->clip_rect() == gfx::ToEnclosingRect(accumulated_clip))
1076 << " layer: " << layer->id() << " clip id: " << layer->clip_tree_index() 982 << " layer: " << layer->id() << " clip id: " << layer->clip_tree_index()
1077 << " layer clip: " << layer->clip_rect().ToString() << " v.s. " 983 << " layer clip: " << layer->clip_rect().ToString() << " v.s. "
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 const LayerImpl* layer) { 1094 const LayerImpl* layer) {
1189 int effect_ancestor_with_copy_request = 1095 int effect_ancestor_with_copy_request =
1190 property_trees->effect_tree.ClosestAncestorWithCopyRequest( 1096 property_trees->effect_tree.ClosestAncestorWithCopyRequest(
1191 layer->effect_tree_index()); 1097 layer->effect_tree_index());
1192 bool non_root_copy_request = 1098 bool non_root_copy_request =
1193 effect_ancestor_with_copy_request > EffectTree::kContentsRootNodeId; 1099 effect_ancestor_with_copy_request > EffectTree::kContentsRootNodeId;
1194 gfx::Rect layer_content_rect = gfx::Rect(layer->bounds()); 1100 gfx::Rect layer_content_rect = gfx::Rect(layer->bounds());
1195 gfx::RectF accumulated_clip_in_root_space; 1101 gfx::RectF accumulated_clip_in_root_space;
1196 if (non_root_copy_request) { 1102 if (non_root_copy_request) {
1197 bool include_viewport_clip = false; 1103 bool include_viewport_clip = false;
1198 bool include_expanding_clips = true;
1199 ConditionalClip accumulated_clip = ComputeAccumulatedClip( 1104 ConditionalClip accumulated_clip = ComputeAccumulatedClip(
1200 property_trees, include_viewport_clip, include_expanding_clips, 1105 property_trees, include_viewport_clip, layer->clip_tree_index(),
1201 layer->clip_tree_index(), effect_ancestor_with_copy_request); 1106 effect_ancestor_with_copy_request);
1202 if (!accumulated_clip.is_clipped) 1107 if (!accumulated_clip.is_clipped)
1203 return layer_content_rect; 1108 return layer_content_rect;
1204 accumulated_clip_in_root_space = accumulated_clip.clip_rect; 1109 accumulated_clip_in_root_space = accumulated_clip.clip_rect;
1205 } else { 1110 } else {
1206 accumulated_clip_in_root_space = 1111 accumulated_clip_in_root_space =
1207 ComputeAccumulatedClipInRootSpaceForVisibleRect( 1112 ComputeAccumulatedClipInRootSpaceForVisibleRect(
1208 property_trees, layer->clip_tree_index()); 1113 property_trees, layer->clip_tree_index());
1209 } 1114 }
1210 1115
1211 const EffectNode* root_effect_node = 1116 const EffectNode* root_effect_node =
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 void UpdateElasticOverscroll(PropertyTrees* property_trees, 1467 void UpdateElasticOverscroll(PropertyTrees* property_trees,
1563 const Layer* overscroll_elasticity_layer, 1468 const Layer* overscroll_elasticity_layer,
1564 const gfx::Vector2dF& elastic_overscroll) { 1469 const gfx::Vector2dF& elastic_overscroll) {
1565 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, 1470 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer,
1566 elastic_overscroll); 1471 elastic_overscroll);
1567 } 1472 }
1568 1473
1569 } // namespace draw_property_utils 1474 } // namespace draw_property_utils
1570 1475
1571 } // namespace cc 1476 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/clip_node.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698