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

Unified Diff: cc/trees/draw_property_utils.cc

Issue 2295463002: [NOT FOR REVIEW] use cominbed clip for visible rect calculation
Patch Set: always use combined clip in target space Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/draw_property_utils.cc
diff --git a/cc/trees/draw_property_utils.cc b/cc/trees/draw_property_utils.cc
index a9b6f3d9114204ddd4e546070a07f6bb0dba34f0..62d9f057d245a258aa8af8c588c12969bdce72bd 100644
--- a/cc/trees/draw_property_utils.cc
+++ b/cc/trees/draw_property_utils.cc
@@ -350,17 +350,6 @@ void CalculateClipRects(
}
}
-bool GetLayerClipRect(const LayerImpl* layer,
- const ClipNode* clip_node,
- const PropertyTrees* property_trees,
- int target_node_id,
- gfx::RectF* clip_rect_in_target_space) {
- // This is equivalent of calling ComputeClipRectInTargetSpace.
- *clip_rect_in_target_space = gfx::RectF(layer->clip_rect());
- return property_trees->transform_tree.Node(target_node_id)
- ->ancestors_are_invertible;
-}
-
void CalculateVisibleRects(const LayerImplList& visible_layer_list,
const PropertyTrees* property_trees,
bool non_root_surfaces_enabled) {
@@ -444,61 +433,8 @@ void CalculateVisibleRects(const LayerImplList& visible_layer_list,
// The clip node stores clip rect in its target space. If required,
// this clip rect should be mapped to the current layer's target space.
- gfx::RectF combined_clip_rect_in_target_space;
-
- if (clip_node->target_transform_id != target_node_id) {
- // In this case, layer has a clip parent or scroll parent (or shares the
- // target with an ancestor layer that has clip parent) and the clip
- // parent's target is different from the layer's target. As the layer's
- // target has unclippped descendants, it is unclippped.
- if (!clip_node->layers_are_clipped) {
- layer->set_visible_layer_rect(gfx::Rect(layer_bounds));
- continue;
- }
-
- // We use the clip node's clip_in_target_space (and not
- // combined_clip_in_target_space) here because we want to clip
- // with respect to clip parent's local clip and not its combined clip as
- // the combined clip has even the clip parent's target's clip baked into
- // it and as our target is different, we don't want to use it in our
- // visible rect computation.
- if (!GetLayerClipRect(layer, clip_node, property_trees, target_node_id,
- &combined_clip_rect_in_target_space)) {
- layer->set_visible_layer_rect(gfx::Rect(layer_bounds));
- continue;
- }
- } else {
- if (clip_node->target_is_clipped) {
- combined_clip_rect_in_target_space =
- clip_node->combined_clip_in_target_space;
- } else {
- combined_clip_rect_in_target_space = clip_node->clip_in_target_space;
- }
- }
-
- // The clip rect should be intersected with layer rect in target space.
- gfx::Transform content_to_target = transform_tree.ToTarget(
- transform_node->id, layer->render_target_effect_tree_index());
- content_to_target.Translate(layer->offset_to_transform_parent().x(),
- layer->offset_to_transform_parent().y());
- gfx::Rect layer_content_rect = gfx::Rect(layer_bounds);
- gfx::RectF layer_content_bounds_in_target_space = MathUtil::MapClippedRect(
- content_to_target, gfx::RectF(layer_content_rect));
- // If the layer is fully contained within the clip, treat it as fully
- // visible.
- if (!layer_content_bounds_in_target_space.IsEmpty() &&
- combined_clip_rect_in_target_space.Contains(
- layer_content_bounds_in_target_space)) {
- layer->set_visible_layer_rect(gfx::Rect(layer_bounds));
- continue;
- }
-
- combined_clip_rect_in_target_space.Intersect(
- layer_content_bounds_in_target_space);
- if (combined_clip_rect_in_target_space.IsEmpty()) {
- layer->set_visible_layer_rect(gfx::Rect());
- continue;
- }
+ gfx::RectF combined_clip_rect_in_target_space =
+ clip_node->combined_clip_in_target_space;
gfx::Transform target_to_layer;
if (transform_node->ancestors_are_invertible) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698