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

Unified Diff: cc/trees/draw_property_utils.cc

Issue 2473453002: cc : Reland move screen space scale factor to root transform node (Closed)
Patch Set: comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/trees/effect_node.cc » ('j') | 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 8894590fa3749eb505b84a14d908c4e45363a1ef..2d6c8f5d77e3cf0756a59f65091d453c2d1b3148 100644
--- a/cc/trees/draw_property_utils.cc
+++ b/cc/trees/draw_property_utils.cc
@@ -171,7 +171,9 @@ static ConditionalClip ComputeCurrentClip(const ClipNode* clip_node,
gfx::RectF current_clip = clip_node->clip;
gfx::Vector2dF surface_contents_scale =
effect_tree.Node(target_effect_id)->surface_contents_scale;
- if (surface_contents_scale.x() > 0 && surface_contents_scale.y() > 0)
+ // The viewport clip should not be scaled.
+ if (surface_contents_scale.x() > 0 && surface_contents_scale.y() > 0 &&
+ clip_node->transform_id != TransformTree::kRootNodeId)
current_clip.Scale(surface_contents_scale.x(), surface_contents_scale.y());
return ConditionalClip{true /* is_clipped */, current_clip};
}
@@ -489,8 +491,7 @@ void CalculateVisibleRects(const LayerImplList& visible_layer_list,
layer->set_visible_layer_rect(gfx::Rect(layer_bounds));
continue;
}
- if (target_effect_node->id > EffectTree::kContentsRootNodeId)
- ConcatInverseSurfaceContentsScale(target_effect_node, &target_to_layer);
+ ConcatInverseSurfaceContentsScale(target_effect_node, &target_to_layer);
}
gfx::Transform target_to_content;
target_to_content.Translate(-layer->offset_to_transform_parent().x(),
@@ -778,19 +779,13 @@ void ComputeClips(PropertyTrees* property_trees,
success &= property_trees->ComputeTransformFromTarget(
clip_node->target_transform_id, parent_clip_node->target_effect_id,
&parent_to_current);
- // We don't have to apply surface contents scale when target is root.
- if (clip_node->target_effect_id != EffectTree::kContentsRootNodeId) {
- const EffectNode* target_effect_node =
- effect_tree.Node(clip_node->target_effect_id);
- PostConcatSurfaceContentsScale(target_effect_node, &parent_to_current);
- }
- if (parent_clip_node->target_effect_id !=
- EffectTree::kContentsRootNodeId) {
- const EffectNode* parent_target_effect_node =
- effect_tree.Node(parent_clip_node->target_effect_id);
- ConcatInverseSurfaceContentsScale(parent_target_effect_node,
- &parent_to_current);
- }
+ const EffectNode* target_effect_node =
+ effect_tree.Node(clip_node->target_effect_id);
+ PostConcatSurfaceContentsScale(target_effect_node, &parent_to_current);
+ const EffectNode* parent_target_effect_node =
+ effect_tree.Node(parent_clip_node->target_effect_id);
+ ConcatInverseSurfaceContentsScale(parent_target_effect_node,
+ &parent_to_current);
// If we can't compute a transform, it's because we had to use the inverse
// of a singular transform. We won't draw in this case, so there's no need
// to compute clips.
@@ -899,8 +894,8 @@ void UpdateRenderTarget(EffectTree* effect_tree,
for (int i = 1; i < static_cast<int>(effect_tree->size()); ++i) {
EffectNode* node = effect_tree->Node(i);
if (i == 1) {
- // Render target on the first effect node is root.
- node->target_id = 0;
+ // Render target of the node corresponding to root is itself.
+ node->target_id = 1;
} else if (!can_render_to_separate_surface) {
node->target_id = 1;
} else if (effect_tree->parent(node)->has_render_surface) {
« no previous file with comments | « no previous file | cc/trees/effect_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698