Chromium Code Reviews| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 ConcatInverseSurfaceContentsScale(target_effect_node, &target_to_local); | 168 ConcatInverseSurfaceContentsScale(target_effect_node, &target_to_local); |
| 169 | 169 |
| 170 if (target_transform_id > local_transform_id) | 170 if (target_transform_id > local_transform_id) |
| 171 return ConditionalClip{true, // is_clipped. | 171 return ConditionalClip{true, // is_clipped. |
| 172 MathUtil::MapClippedRect(target_to_local, rect)}; | 172 MathUtil::MapClippedRect(target_to_local, rect)}; |
| 173 | 173 |
| 174 return ConditionalClip{true, // is_clipped. | 174 return ConditionalClip{true, // is_clipped. |
| 175 MathUtil::ProjectClippedRect(target_to_local, rect)}; | 175 MathUtil::ProjectClippedRect(target_to_local, rect)}; |
| 176 } | 176 } |
| 177 | 177 |
| 178 static ConditionalClip ComputeTargetRectInTargetSpace( | |
|
weiliangc
2016/10/26 16:57:03
This functions seems more like "ConvertRectBetween
ajuma
2016/10/31 17:43:07
Done.
| |
| 179 gfx::RectF rect, | |
| 180 const PropertyTrees* property_trees, | |
| 181 int source_transform_id, | |
| 182 int source_effect_id, | |
| 183 int dest_transform_id, | |
| 184 int dest_effect_id) { | |
| 185 gfx::Transform source_to_dest; | |
| 186 bool success = property_trees->ComputeTransformToTarget( | |
| 187 source_transform_id, dest_effect_id, &source_to_dest); | |
| 188 if (!success) | |
| 189 return ConditionalClip{false, gfx::RectF()}; | |
| 190 const EffectTree& effect_tree = property_trees->effect_tree; | |
| 191 const EffectNode* source_effect_node = effect_tree.Node(source_effect_id); | |
| 192 const EffectNode* dest_effect_node = effect_tree.Node(dest_effect_id); | |
| 193 ConcatInverseSurfaceContentsScale(source_effect_node, &source_to_dest); | |
| 194 PostConcatSurfaceContentsScale(dest_effect_node, &source_to_dest); | |
| 195 if (source_transform_id > dest_transform_id) { | |
| 196 return ConditionalClip{true, // is_clipped | |
| 197 MathUtil::MapClippedRect(source_to_dest, rect)}; | |
| 198 } | |
| 199 return ConditionalClip{true, // is_clipped | |
| 200 MathUtil::ProjectClippedRect(source_to_dest, rect)}; | |
| 201 } | |
| 202 | |
| 178 static ConditionalClip ComputeLocalRectInTargetSpace( | 203 static ConditionalClip ComputeLocalRectInTargetSpace( |
| 179 gfx::RectF rect, | 204 gfx::RectF rect, |
| 180 const PropertyTrees* property_trees, | 205 const PropertyTrees* property_trees, |
| 181 int current_transform_id, | 206 int current_transform_id, |
| 182 int target_transform_id, | 207 int target_transform_id, |
| 183 int target_effect_id) { | 208 int target_effect_id) { |
| 184 gfx::Transform current_to_target; | 209 gfx::Transform current_to_target; |
| 185 if (!property_trees->ComputeTransformToTarget( | 210 if (!property_trees->ComputeTransformToTarget( |
| 186 current_transform_id, target_effect_id, ¤t_to_target)) | 211 current_transform_id, target_effect_id, ¤t_to_target)) |
| 187 // If transform is not invertible, cannot apply clip. | 212 // If transform is not invertible, cannot apply clip. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 gfx::Vector2dF surface_contents_scale = | 245 gfx::Vector2dF surface_contents_scale = |
| 221 effect_tree.Node(target_effect_id)->surface_contents_scale; | 246 effect_tree.Node(target_effect_id)->surface_contents_scale; |
| 222 if (surface_contents_scale.x() > 0 && surface_contents_scale.y() > 0) | 247 if (surface_contents_scale.x() > 0 && surface_contents_scale.y() > 0) |
| 223 current_clip.Scale(surface_contents_scale.x(), surface_contents_scale.y()); | 248 current_clip.Scale(surface_contents_scale.x(), surface_contents_scale.y()); |
| 224 return ConditionalClip{true /* is_clipped */, current_clip}; | 249 return ConditionalClip{true /* is_clipped */, current_clip}; |
| 225 } | 250 } |
| 226 | 251 |
| 227 static ConditionalClip ComputeAccumulatedClip( | 252 static ConditionalClip ComputeAccumulatedClip( |
| 228 const PropertyTrees* property_trees, | 253 const PropertyTrees* property_trees, |
| 229 bool include_clip_applied_by_target, | 254 bool include_clip_applied_by_target, |
| 255 bool include_expanding_clips, | |
|
weiliangc
2016/10/26 16:57:03
This seem to be not used?
ajuma
2016/10/31 17:43:07
Oops, I forgot to handle that case, thanks for cat
| |
| 230 int local_clip_id, | 256 int local_clip_id, |
| 231 int target_id) { | 257 int target_id) { |
| 232 const ClipTree& clip_tree = property_trees->clip_tree; | 258 const ClipTree& clip_tree = property_trees->clip_tree; |
| 233 const EffectTree& effect_tree = property_trees->effect_tree; | 259 const EffectTree& effect_tree = property_trees->effect_tree; |
| 234 | 260 |
| 235 const ClipNode* clip_node = clip_tree.Node(local_clip_id); | 261 const ClipNode* clip_node = clip_tree.Node(local_clip_id); |
| 236 const EffectNode* target_node = effect_tree.Node(target_id); | 262 const EffectNode* target_node = effect_tree.Node(target_id); |
| 237 int target_transform_id = target_node->transform_id; | 263 int target_transform_id = target_node->transform_id; |
| 238 bool is_clipped = false; | 264 bool is_clipped = false; |
| 239 | 265 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 258 // There aren't any clips to apply. | 284 // There aren't any clips to apply. |
| 259 return ConditionalClip{false, gfx::RectF()}; | 285 return ConditionalClip{false, gfx::RectF()}; |
| 260 } | 286 } |
| 261 | 287 |
| 262 if (!include_clip_applied_by_target) { | 288 if (!include_clip_applied_by_target) { |
| 263 clip_node = parent_chain.top(); | 289 clip_node = parent_chain.top(); |
| 264 parent_chain.pop(); | 290 parent_chain.pop(); |
| 265 } | 291 } |
| 266 | 292 |
| 267 // TODO(weiliangc): If we don't create clip for render surface, we don't need | 293 // TODO(weiliangc): If we don't create clip for render surface, we don't need |
| 268 // to check applies_local_clip. | 294 // to check clip_type. |
| 269 while (clip_node->clip_type != ClipNode::ClipType::APPLIES_LOCAL_CLIP && | 295 while (clip_node->clip_type == ClipNode::ClipType::NONE && |
|
ajuma
2016/10/31 17:43:07
I wasn't handling the case where the first clip in
| |
| 270 parent_chain.size() > 0) { | 296 parent_chain.size() > 0) { |
| 271 clip_node = parent_chain.top(); | 297 clip_node = parent_chain.top(); |
| 272 parent_chain.pop(); | 298 parent_chain.pop(); |
| 273 } | 299 } |
| 274 | 300 |
| 275 if (clip_node->clip_type != ClipNode::ClipType::APPLIES_LOCAL_CLIP) | 301 if (clip_node->clip_type == ClipNode::ClipType::NONE) |
| 276 // No clip node applying clip in between. | 302 // No clip node applying clip in between. |
| 277 return ConditionalClip{false, gfx::RectF()}; | 303 return ConditionalClip{false, gfx::RectF()}; |
| 278 | 304 |
| 279 ConditionalClip current_clip = ComputeCurrentClip( | 305 ConditionalClip current_clip = ComputeCurrentClip( |
| 280 clip_node, property_trees, target_transform_id, target_id); | 306 clip_node, property_trees, target_transform_id, target_id); |
| 281 is_clipped = current_clip.is_clipped; | 307 is_clipped = current_clip.is_clipped; |
| 282 gfx::RectF accumulated_clip = current_clip.clip_rect; | 308 gfx::RectF accumulated_clip = current_clip.clip_rect; |
| 283 | 309 |
| 284 while (parent_chain.size() > 0) { | 310 while (parent_chain.size() > 0) { |
| 285 clip_node = parent_chain.top(); | 311 clip_node = parent_chain.top(); |
| 286 parent_chain.pop(); | 312 parent_chain.pop(); |
| 287 if (clip_node->clip_type != ClipNode::ClipType::APPLIES_LOCAL_CLIP) { | 313 switch (clip_node->clip_type) { |
|
weiliangc
2016/10/26 16:57:03
Nit: maybe make a helper function that applies cli
ajuma
2016/10/31 17:43:07
Done.
| |
| 288 continue; | 314 case ClipNode::ClipType::APPLIES_LOCAL_CLIP: { |
| 315 ConditionalClip current_clip = ComputeCurrentClip( | |
| 316 clip_node, property_trees, target_transform_id, target_id); | |
| 317 | |
| 318 // If transform is not invertible, no clip will be applied. | |
| 319 if (!current_clip.is_clipped) | |
| 320 return ConditionalClip{false, gfx::RectF()}; | |
| 321 | |
| 322 is_clipped = true; | |
| 323 accumulated_clip = | |
| 324 gfx::IntersectRects(accumulated_clip, current_clip.clip_rect); | |
| 325 break; | |
| 326 } | |
| 327 case ClipNode::ClipType::EXPANDS_CLIP: { | |
| 328 // Bring the accumulated clip to the space of the expanding effect. | |
| 329 const EffectNode* expanding_effect_node = | |
| 330 effect_tree.Node(clip_node->clip_expander.target_effect_id()); | |
| 331 ConditionalClip accumulated_clip_in_expanding_space = | |
| 332 ComputeTargetRectInTargetSpace(accumulated_clip, property_trees, | |
| 333 target_transform_id, target_id, | |
| 334 expanding_effect_node->transform_id, | |
| 335 expanding_effect_node->id); | |
| 336 // If transform is not invertible, no clip will be applied. | |
| 337 if (!accumulated_clip_in_expanding_space.is_clipped) | |
| 338 return ConditionalClip{false, gfx::RectF()}; | |
| 339 | |
| 340 // Do the expansion. | |
| 341 gfx::RectF expanded_clip_in_expanding_space = | |
| 342 gfx::RectF(clip_node->clip_expander.MapRectReverse( | |
| 343 gfx::ToEnclosingRect( | |
| 344 accumulated_clip_in_expanding_space.clip_rect), | |
| 345 property_trees)); | |
| 346 | |
| 347 // Put the expanded clip back into the original target space. | |
| 348 ConditionalClip expanded_clip_in_target_space = | |
| 349 ComputeTargetRectInTargetSpace( | |
| 350 expanded_clip_in_expanding_space, property_trees, | |
| 351 expanding_effect_node->transform_id, expanding_effect_node->id, | |
| 352 target_transform_id, target_id); | |
| 353 // If transform is not invertible, no clip will be applied. | |
| 354 if (!expanded_clip_in_target_space.is_clipped) | |
| 355 return ConditionalClip{false, gfx::RectF()}; | |
| 356 accumulated_clip = expanded_clip_in_target_space.clip_rect; | |
| 357 break; | |
| 358 } | |
| 359 case ClipNode::ClipType::NONE: | |
| 360 break; | |
| 289 } | 361 } |
| 290 ConditionalClip current_clip = ComputeCurrentClip( | |
| 291 clip_node, property_trees, target_transform_id, target_id); | |
| 292 | |
| 293 // If transform is not invertible, no clip will be applied. | |
| 294 if (!current_clip.is_clipped) | |
| 295 return ConditionalClip{false, gfx::RectF()}; | |
| 296 | |
| 297 is_clipped = true; | |
| 298 accumulated_clip = | |
| 299 gfx::IntersectRects(accumulated_clip, current_clip.clip_rect); | |
| 300 } | 362 } |
| 301 | 363 |
| 302 return ConditionalClip{ | 364 return ConditionalClip{ |
| 303 is_clipped, accumulated_clip.IsEmpty() ? gfx::RectF() : accumulated_clip}; | 365 is_clipped, accumulated_clip.IsEmpty() ? gfx::RectF() : accumulated_clip}; |
| 304 } | 366 } |
| 305 | 367 |
| 306 static gfx::RectF ComputeAccumulatedClipInRootSpaceForVisibleRect( | 368 static gfx::RectF ComputeAccumulatedClipInRootSpaceForVisibleRect( |
| 307 const PropertyTrees* property_trees, | 369 const PropertyTrees* property_trees, |
| 308 int local_clip_id) { | 370 int local_clip_id) { |
| 309 const int root_effect_id = EffectTree::kContentsRootNodeId; | 371 const int root_effect_id = EffectTree::kContentsRootNodeId; |
| 310 bool include_clip_applied_by_target = true; | 372 bool include_clip_applied_by_target = true; |
| 311 ConditionalClip accumulated_clip = | 373 bool include_expanding_clips = true; |
| 312 ComputeAccumulatedClip(property_trees, include_clip_applied_by_target, | 374 ConditionalClip accumulated_clip = ComputeAccumulatedClip( |
| 313 local_clip_id, root_effect_id); | 375 property_trees, include_clip_applied_by_target, include_expanding_clips, |
| 376 local_clip_id, root_effect_id); | |
| 314 DCHECK(accumulated_clip.is_clipped); | 377 DCHECK(accumulated_clip.is_clipped); |
| 315 return accumulated_clip.clip_rect; | 378 return accumulated_clip.clip_rect; |
| 316 } | 379 } |
| 317 | 380 |
| 318 void CalculateClipRects(const std::vector<LayerImpl*>& visible_layer_list, | 381 void CalculateClipRects(const std::vector<LayerImpl*>& visible_layer_list, |
| 319 const PropertyTrees* property_trees, | 382 const PropertyTrees* property_trees, |
| 320 bool non_root_surfaces_enabled) { | 383 bool non_root_surfaces_enabled) { |
| 321 const ClipTree& clip_tree = property_trees->clip_tree; | 384 const ClipTree& clip_tree = property_trees->clip_tree; |
| 322 for (auto& layer : visible_layer_list) { | 385 for (auto& layer : visible_layer_list) { |
| 323 const ClipNode* clip_node = clip_tree.Node(layer->clip_tree_index()); | 386 const ClipNode* clip_node = clip_tree.Node(layer->clip_tree_index()); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 const TransformTree& transform_tree = property_trees->transform_tree; | 438 const TransformTree& transform_tree = property_trees->transform_tree; |
| 376 const ClipTree& clip_tree = property_trees->clip_tree; | 439 const ClipTree& clip_tree = property_trees->clip_tree; |
| 377 for (auto& layer : visible_layer_list) { | 440 for (auto& layer : visible_layer_list) { |
| 378 gfx::Size layer_bounds = layer->bounds(); | 441 gfx::Size layer_bounds = layer->bounds(); |
| 379 | 442 |
| 380 int effect_ancestor_with_copy_request = | 443 int effect_ancestor_with_copy_request = |
| 381 effect_tree.ClosestAncestorWithCopyRequest(layer->effect_tree_index()); | 444 effect_tree.ClosestAncestorWithCopyRequest(layer->effect_tree_index()); |
| 382 if (effect_ancestor_with_copy_request > 1) { | 445 if (effect_ancestor_with_copy_request > 1) { |
| 383 // Non root copy request. | 446 // Non root copy request. |
| 384 bool include_clip_applied_by_target = false; | 447 bool include_clip_applied_by_target = false; |
| 448 bool include_expanding_clips = true; | |
| 385 ConditionalClip accumulated_clip_rect = ComputeAccumulatedClip( | 449 ConditionalClip accumulated_clip_rect = ComputeAccumulatedClip( |
| 386 property_trees, include_clip_applied_by_target, | 450 property_trees, include_clip_applied_by_target, |
| 387 layer->clip_tree_index(), effect_ancestor_with_copy_request); | 451 include_expanding_clips, layer->clip_tree_index(), |
| 452 effect_ancestor_with_copy_request); | |
| 388 if (!accumulated_clip_rect.is_clipped) { | 453 if (!accumulated_clip_rect.is_clipped) { |
| 389 layer->set_visible_layer_rect(gfx::Rect(layer_bounds)); | 454 layer->set_visible_layer_rect(gfx::Rect(layer_bounds)); |
| 390 continue; | 455 continue; |
| 391 } | 456 } |
| 392 | 457 |
| 393 gfx::RectF accumulated_clip_in_copy_request_space = | 458 gfx::RectF accumulated_clip_in_copy_request_space = |
| 394 accumulated_clip_rect.clip_rect; | 459 accumulated_clip_rect.clip_rect; |
| 395 | 460 |
| 396 const EffectNode* copy_request_effect_node = | 461 const EffectNode* copy_request_effect_node = |
| 397 effect_tree.Node(effect_ancestor_with_copy_request); | 462 effect_tree.Node(effect_ancestor_with_copy_request); |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 841 effect_tree, transform_tree); | 906 effect_tree, transform_tree); |
| 842 #endif | 907 #endif |
| 843 } | 908 } |
| 844 // If we can't compute a transform, it's because we had to use the inverse | 909 // If we can't compute a transform, it's because we had to use the inverse |
| 845 // of a singular transform. We won't draw in this case, so there's no need | 910 // of a singular transform. We won't draw in this case, so there's no need |
| 846 // to compute clips. | 911 // to compute clips. |
| 847 if (!success) | 912 if (!success) |
| 848 continue; | 913 continue; |
| 849 parent_combined_clip_in_target_space = MathUtil::ProjectClippedRect( | 914 parent_combined_clip_in_target_space = MathUtil::ProjectClippedRect( |
| 850 parent_to_current, parent_clip_node->combined_clip_in_target_space); | 915 parent_to_current, parent_clip_node->combined_clip_in_target_space); |
| 916 if (clip_node->clip_type == ClipNode::ClipType::EXPANDS_CLIP) { | |
| 917 parent_combined_clip_in_target_space = | |
| 918 gfx::RectF(clip_node->clip_expander.MapRectReverse( | |
| 919 gfx::ToEnclosingRect(parent_combined_clip_in_target_space), | |
| 920 property_trees)); | |
| 921 } | |
| 851 parent_clip_in_target_space = MathUtil::ProjectClippedRect( | 922 parent_clip_in_target_space = MathUtil::ProjectClippedRect( |
| 852 parent_to_current, parent_clip_node->clip_in_target_space); | 923 parent_to_current, parent_clip_node->clip_in_target_space); |
| 853 } | 924 } |
| 854 // Only nodes affected by ancestor clips will have their clip adjusted due | 925 // Only nodes affected by ancestor clips will have their clip adjusted due |
| 855 // to intersecting with an ancestor clip. But, we still need to propagate | 926 // to intersecting with an ancestor clip. But, we still need to propagate |
| 856 // the combined clip to our children because if they are clipped, they may | 927 // the combined clip to our children because if they are clipped, they may |
| 857 // need to clip using our parent clip and if we don't propagate it here, | 928 // need to clip using our parent clip and if we don't propagate it here, |
| 858 // it will be lost. | 929 // it will be lost. |
| 859 if (clip_node->resets_clip && non_root_surfaces_enabled) { | 930 if (clip_node->resets_clip && non_root_surfaces_enabled) { |
| 860 if (clip_node->clip_type == ClipNode::ClipType::APPLIES_LOCAL_CLIP) { | 931 if (clip_node->clip_type == ClipNode::ClipType::APPLIES_LOCAL_CLIP) { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 988 gfx::ToEnclosingRect(clip_tree->Node(root_effect_node->clip_id)->clip); | 1059 gfx::ToEnclosingRect(clip_tree->Node(root_effect_node->clip_id)->clip); |
| 989 if (root_render_surface->is_clipped()) | 1060 if (root_render_surface->is_clipped()) |
| 990 DCHECK(root_clip == root_render_surface->clip_rect()) | 1061 DCHECK(root_clip == root_render_surface->clip_rect()) |
| 991 << "clip on root render surface: " | 1062 << "clip on root render surface: " |
| 992 << root_render_surface->clip_rect().ToString() | 1063 << root_render_surface->clip_rect().ToString() |
| 993 << " v.s. root effect node's clip: " << root_clip.ToString(); | 1064 << " v.s. root effect node's clip: " << root_clip.ToString(); |
| 994 for (int i = 2; i < static_cast<int>(effect_tree->size()); ++i) { | 1065 for (int i = 2; i < static_cast<int>(effect_tree->size()); ++i) { |
| 995 EffectNode* effect_node = effect_tree->Node(i); | 1066 EffectNode* effect_node = effect_tree->Node(i); |
| 996 const EffectNode* target_node = effect_tree->Node(effect_node->target_id); | 1067 const EffectNode* target_node = effect_tree->Node(effect_node->target_id); |
| 997 bool include_clip_applied_by_target = false; | 1068 bool include_clip_applied_by_target = false; |
| 998 ConditionalClip accumulated_clip_rect = | 1069 bool include_expanding_clips = false; |
| 999 ComputeAccumulatedClip(property_trees, include_clip_applied_by_target, | 1070 ConditionalClip accumulated_clip_rect = ComputeAccumulatedClip( |
| 1000 effect_node->clip_id, target_node->id); | 1071 property_trees, include_clip_applied_by_target, include_expanding_clips, |
| 1072 effect_node->clip_id, target_node->id); | |
| 1001 gfx::RectF accumulated_clip = accumulated_clip_rect.clip_rect; | 1073 gfx::RectF accumulated_clip = accumulated_clip_rect.clip_rect; |
| 1002 const RenderSurfaceImpl* render_surface = effect_node->render_surface; | 1074 const RenderSurfaceImpl* render_surface = effect_node->render_surface; |
| 1003 if (render_surface && render_surface->is_clipped()) { | 1075 if (render_surface && render_surface->is_clipped()) { |
| 1004 DCHECK(gfx::ToEnclosingRect(accumulated_clip) == | 1076 DCHECK(gfx::ToEnclosingRect(accumulated_clip) == |
| 1005 render_surface->clip_rect()) | 1077 render_surface->clip_rect()) |
| 1006 << " render surface's clip rect: " | 1078 << " render surface's clip rect: " |
| 1007 << render_surface->clip_rect().ToString() | 1079 << render_surface->clip_rect().ToString() |
| 1008 << " v.s. accumulated clip: " | 1080 << " v.s. accumulated clip: " |
| 1009 << gfx::ToEnclosingRect(accumulated_clip).ToString(); | 1081 << gfx::ToEnclosingRect(accumulated_clip).ToString(); |
| 1010 } | 1082 } |
| 1011 } | 1083 } |
| 1012 } | 1084 } |
| 1013 | 1085 |
| 1014 static void ComputeLayerClipRect(const PropertyTrees* property_trees, | 1086 static void ComputeLayerClipRect(const PropertyTrees* property_trees, |
| 1015 const LayerImpl* layer) { | 1087 const LayerImpl* layer) { |
| 1016 const EffectTree* effect_tree = &property_trees->effect_tree; | 1088 const EffectTree* effect_tree = &property_trees->effect_tree; |
| 1017 const ClipTree* clip_tree = &property_trees->clip_tree; | 1089 const ClipTree* clip_tree = &property_trees->clip_tree; |
| 1018 const EffectNode* effect_node = effect_tree->Node(layer->effect_tree_index()); | 1090 const EffectNode* effect_node = effect_tree->Node(layer->effect_tree_index()); |
| 1019 const EffectNode* target_node = | 1091 const EffectNode* target_node = |
| 1020 effect_node->has_render_surface | 1092 effect_node->has_render_surface |
| 1021 ? effect_node | 1093 ? effect_node |
| 1022 : effect_tree->Node(effect_node->target_id); | 1094 : effect_tree->Node(effect_node->target_id); |
| 1023 // TODO(weiliangc): When effect node has up to date render surface info on | 1095 // TODO(weiliangc): When effect node has up to date render surface info on |
| 1024 // compositor thread, no need to check for resourceless draw mode | 1096 // compositor thread, no need to check for resourceless draw mode |
| 1025 if (!property_trees->non_root_surfaces_enabled) { | 1097 if (!property_trees->non_root_surfaces_enabled) { |
| 1026 target_node = effect_tree->Node(1); | 1098 target_node = effect_tree->Node(1); |
| 1027 } | 1099 } |
| 1028 | 1100 |
| 1029 bool include_clip_applied_by_target = false; | 1101 bool include_clip_applied_by_target = false; |
| 1030 ConditionalClip accumulated_clip_rect = | 1102 bool include_expanding_clips = false; |
| 1031 ComputeAccumulatedClip(property_trees, include_clip_applied_by_target, | 1103 ConditionalClip accumulated_clip_rect = ComputeAccumulatedClip( |
| 1032 layer->clip_tree_index(), target_node->id); | 1104 property_trees, include_clip_applied_by_target, include_expanding_clips, |
| 1105 layer->clip_tree_index(), target_node->id); | |
| 1033 | 1106 |
| 1034 gfx::RectF accumulated_clip = accumulated_clip_rect.clip_rect; | 1107 gfx::RectF accumulated_clip = accumulated_clip_rect.clip_rect; |
| 1035 | 1108 |
| 1036 if ((!property_trees->non_root_surfaces_enabled && | 1109 if ((!property_trees->non_root_surfaces_enabled && |
| 1037 clip_tree->Node(layer->clip_tree_index()) | 1110 clip_tree->Node(layer->clip_tree_index()) |
| 1038 ->layers_are_clipped_when_surfaces_disabled) || | 1111 ->layers_are_clipped_when_surfaces_disabled) || |
| 1039 clip_tree->Node(layer->clip_tree_index())->layers_are_clipped) { | 1112 clip_tree->Node(layer->clip_tree_index())->layers_are_clipped) { |
| 1040 DCHECK(layer->clip_rect() == gfx::ToEnclosingRect(accumulated_clip)) | 1113 DCHECK(layer->clip_rect() == gfx::ToEnclosingRect(accumulated_clip)) |
| 1041 << " layer: " << layer->id() << " clip id: " << layer->clip_tree_index() | 1114 << " layer: " << layer->id() << " clip id: " << layer->clip_tree_index() |
| 1042 << " layer clip: " << layer->clip_rect().ToString() << " v.s. " | 1115 << " layer clip: " << layer->clip_rect().ToString() << " v.s. " |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1204 const LayerImpl* layer) { | 1277 const LayerImpl* layer) { |
| 1205 int effect_ancestor_with_copy_request = | 1278 int effect_ancestor_with_copy_request = |
| 1206 property_trees->effect_tree.ClosestAncestorWithCopyRequest( | 1279 property_trees->effect_tree.ClosestAncestorWithCopyRequest( |
| 1207 layer->effect_tree_index()); | 1280 layer->effect_tree_index()); |
| 1208 bool non_root_copy_request = | 1281 bool non_root_copy_request = |
| 1209 effect_ancestor_with_copy_request > EffectTree::kContentsRootNodeId; | 1282 effect_ancestor_with_copy_request > EffectTree::kContentsRootNodeId; |
| 1210 gfx::Rect layer_content_rect = gfx::Rect(layer->bounds()); | 1283 gfx::Rect layer_content_rect = gfx::Rect(layer->bounds()); |
| 1211 gfx::RectF accumulated_clip_in_root_space; | 1284 gfx::RectF accumulated_clip_in_root_space; |
| 1212 if (non_root_copy_request) { | 1285 if (non_root_copy_request) { |
| 1213 bool include_clip_applied_by_target = false; | 1286 bool include_clip_applied_by_target = false; |
| 1287 bool include_expanding_clips = true; | |
| 1214 ConditionalClip accumulated_clip = ComputeAccumulatedClip( | 1288 ConditionalClip accumulated_clip = ComputeAccumulatedClip( |
| 1215 property_trees, include_clip_applied_by_target, | 1289 property_trees, include_clip_applied_by_target, include_expanding_clips, |
| 1216 layer->clip_tree_index(), effect_ancestor_with_copy_request); | 1290 layer->clip_tree_index(), effect_ancestor_with_copy_request); |
| 1217 if (!accumulated_clip.is_clipped) | 1291 if (!accumulated_clip.is_clipped) |
| 1218 return layer_content_rect; | 1292 return layer_content_rect; |
| 1219 accumulated_clip_in_root_space = accumulated_clip.clip_rect; | 1293 accumulated_clip_in_root_space = accumulated_clip.clip_rect; |
| 1220 } else { | 1294 } else { |
| 1221 accumulated_clip_in_root_space = | 1295 accumulated_clip_in_root_space = |
| 1222 ComputeAccumulatedClipInRootSpaceForVisibleRect( | 1296 ComputeAccumulatedClipInRootSpaceForVisibleRect( |
| 1223 property_trees, layer->clip_tree_index()); | 1297 property_trees, layer->clip_tree_index()); |
| 1224 } | 1298 } |
| 1225 | 1299 |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1604 void UpdateElasticOverscroll(PropertyTrees* property_trees, | 1678 void UpdateElasticOverscroll(PropertyTrees* property_trees, |
| 1605 const Layer* overscroll_elasticity_layer, | 1679 const Layer* overscroll_elasticity_layer, |
| 1606 const gfx::Vector2dF& elastic_overscroll) { | 1680 const gfx::Vector2dF& elastic_overscroll) { |
| 1607 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, | 1681 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, |
| 1608 elastic_overscroll); | 1682 elastic_overscroll); |
| 1609 } | 1683 } |
| 1610 | 1684 |
| 1611 } // namespace draw_property_utils | 1685 } // namespace draw_property_utils |
| 1612 | 1686 |
| 1613 } // namespace cc | 1687 } // namespace cc |
| OLD | NEW |