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

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

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

Powered by Google App Engine
This is Rietveld 408576698