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

Unified Diff: cc/trees/draw_property_utils.cc

Issue 2140313004: cc: Fix non root copy request visible rect in HighDPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 5 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 | « cc/test/layer_tree_host_common_test.cc ('k') | cc/trees/layer_tree_host_common_unittest.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 50c2b90e22594d9278645725e350df498b70e5f3..8b1ac42a87c5b121abd68b144745a7e1aa295942 100644
--- a/cc/trees/draw_property_utils.cc
+++ b/cc/trees/draw_property_utils.cc
@@ -97,7 +97,26 @@ struct ConditionalClip {
gfx::RectF clip_rect;
};
-static ConditionalClip ComputeRectInTargetSpace(
+static ConditionalClip ComputeTargetRectInLocalSpace(
+ gfx::RectF rect,
+ const TransformTree& transform_tree,
+ int current_transform_id,
+ int target_transform_id) {
+ gfx::Transform current_to_target;
+ if (!transform_tree.ComputeTransformWithSourceSublayerScale(
+ current_transform_id, target_transform_id, &current_to_target))
+ // If transform is not invertible, cannot apply clip.
+ return ConditionalClip{false, gfx::RectF()};
+
+ if (current_transform_id > target_transform_id)
+ return ConditionalClip{true, // is_clipped.
+ MathUtil::MapClippedRect(current_to_target, rect)};
+
+ return ConditionalClip{true, // is_clipped.
+ MathUtil::ProjectClippedRect(current_to_target, rect)};
+}
+
+static ConditionalClip ComputeLocalRectInTargetSpace(
gfx::RectF rect,
const TransformTree& transform_tree,
int current_transform_id,
@@ -107,6 +126,7 @@ static ConditionalClip ComputeRectInTargetSpace(
current_transform_id, target_transform_id, &current_to_target))
// If transform is not invertible, cannot apply clip.
return ConditionalClip{false, gfx::RectF()};
+
if (current_transform_id > target_transform_id)
return ConditionalClip{true, // is_clipped.
MathUtil::MapClippedRect(current_to_target, rect)};
@@ -119,9 +139,9 @@ static ConditionalClip ComputeCurrentClip(const ClipNode* clip_node,
const TransformTree& transform_tree,
int target_transform_id) {
if (clip_node->data.transform_id != target_transform_id)
- return ComputeRectInTargetSpace(clip_node->data.clip, transform_tree,
- clip_node->data.transform_id,
- target_transform_id);
+ return ComputeLocalRectInTargetSpace(clip_node->data.clip, transform_tree,
+ clip_node->data.transform_id,
+ target_transform_id);
gfx::RectF current_clip = clip_node->data.clip;
gfx::Vector2dF sublayer_scale =
@@ -315,10 +335,11 @@ void CalculateVisibleRects(
const EffectNode* copy_request_effect_node =
effect_tree.Node(effect_ancestor_with_copy_request);
- ConditionalClip clip_in_layer_space = ComputeRectInTargetSpace(
+ ConditionalClip clip_in_layer_space = ComputeTargetRectInLocalSpace(
accumulated_clip_in_copy_request_space, transform_tree,
copy_request_effect_node->data.transform_id,
layer->transform_tree_index());
+
if (clip_in_layer_space.is_clipped) {
gfx::RectF clip_rect = clip_in_layer_space.clip_rect;
clip_rect.Offset(-layer->offset_to_transform_parent());
« no previous file with comments | « cc/test/layer_tree_host_common_test.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