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

Unified Diff: cc/trees/layer_tree_host_common.cc

Issue 216973006: Fix fixed-pos jitter related to physical pixel snapping. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Group code together with contents scale as before Created 6 years, 9 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 | 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/layer_tree_host_common.cc
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index c1bc1a12c4dff940fccb6e5f4c4bbb2e89d79213..88b30bbbf62a62d6bb6b04e822fcf2d7fbe1780b 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -1518,25 +1518,6 @@ static void CalculateDrawPropertiesInternal(
combined_transform.Translate(position.x(), position.y());
}
- gfx::Vector2dF effective_scroll_delta = GetEffectiveScrollDelta(layer);
- if (!animating_transform_to_target && layer->scrollable() &&
- combined_transform.IsScaleOrTranslation()) {
- // Align the scrollable layer's position to screen space pixels to avoid
- // blurriness. To avoid side-effects, do this only if the transform is
- // simple.
- gfx::Vector2dF previous_translation = combined_transform.To2dTranslation();
- RoundTranslationComponents(&combined_transform);
- gfx::Vector2dF current_translation = combined_transform.To2dTranslation();
-
- // This rounding changes the scroll delta, and so must be included
- // in the scroll compensation matrix.
- effective_scroll_delta -= current_translation - previous_translation;
- }
-
- // Apply adjustment from position constraints.
- ApplyPositionAdjustment(layer, data_from_ancestor.fixed_container,
- data_from_ancestor.scroll_compensation_matrix, &combined_transform);
-
// Compute the 2d scale components of the transform hierarchy up to the target
// surface. From there, we can decide on a contents scale for the layer.
float layer_scale_factors = globals.device_scale_factor;
@@ -1561,6 +1542,30 @@ static void CalculateDrawPropertiesInternal(
globals.page_scale_factor : 1.f,
animating_transform_to_screen);
+ gfx::Vector2dF effective_scroll_delta = GetEffectiveScrollDelta(layer);
+ if (!animating_transform_to_target && layer->scrollable() &&
+ combined_transform.IsScaleOrTranslation()) {
+ // Align the scrollable layer's position to screen space pixels to avoid
+ // blurriness. To avoid side-effects, do this only if the transform is
+ // simple.
+ gfx::Vector2dF previous_translation = combined_transform.To2dTranslation();
+ RoundTranslationComponents(&combined_transform);
+ gfx::Vector2dF current_translation = combined_transform.To2dTranslation();
+
+ // This rounding changes the scroll delta, and so must be included
+ // in the scroll compensation matrix.
enne (OOO) 2014/03/31 22:45:22 Can you also mention why you're scaling the offset
aelias_OOO_until_Jul13 2014/04/01 06:24:20 Added a longer comment.
+ effective_scroll_delta -=
+ gfx::ScaleVector2d(current_translation - previous_translation,
+ 1 / combined_transform_scales.x(),
enne (OOO) 2014/03/31 22:45:22 style nit: 1.f
aelias_OOO_until_Jul13 2014/04/01 06:24:20 Done.
+ 1 / combined_transform_scales.y());
+ }
+
+ // Apply adjustment from position constraints.
+ ApplyPositionAdjustment(layer,
+ data_from_ancestor.fixed_container,
+ data_from_ancestor.scroll_compensation_matrix,
+ &combined_transform);
+
// The draw_transform that gets computed below is effectively the layer's
// draw_transform, unless the layer itself creates a render_surface. In that
// case, the render_surface re-parents the transforms.
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698