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

Unified Diff: cc/layer_tree_host_common.cc

Issue 11362151: cc: Do not save the rasterScale for layers until they are finished animating transforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « cc/layer_animation_controller_unittest.cc ('k') | cc/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/layer_tree_host_common.cc
diff --git a/cc/layer_tree_host_common.cc b/cc/layer_tree_host_common.cc
index 662d5d82098e4a224d060daaa854c9b4ac3cf06b..e64a339aa8c2f3d7afc0848bdd401e50336f015c 100644
--- a/cc/layer_tree_host_common.cc
+++ b/cc/layer_tree_host_common.cc
@@ -349,15 +349,15 @@ WebTransformationMatrix computeScrollCompensationMatrixForChildren(LayerImpl* la
}
// There is no contentsScale on impl thread.
-static inline void updateLayerContentsScale(LayerImpl*, const WebTransformationMatrix&, float, float) { }
+static inline void updateLayerContentsScale(LayerImpl*, const WebTransformationMatrix&, float, float, bool) { }
-static inline void updateLayerContentsScale(Layer* layer, const WebTransformationMatrix& combinedTransform, float deviceScaleFactor, float pageScaleFactor)
+static inline void updateLayerContentsScale(Layer* layer, const WebTransformationMatrix& combinedTransform, float deviceScaleFactor, float pageScaleFactor, bool animatingTransformToScreen)
{
float rasterScale = layer->rasterScale();
if (!rasterScale) {
rasterScale = 1;
- if (layer->automaticallyComputeRasterScale()) {
+ if (!animatingTransformToScreen && layer->automaticallyComputeRasterScale()) {
gfx::Vector2dF transformScale = MathUtil::computeTransform2dScaleComponents(combinedTransform);
float combinedScale = std::max(transformScale.x(), transformScale.y());
rasterScale = combinedScale / deviceScaleFactor;
@@ -489,6 +489,13 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
drawOpacityIsAnimating |= layer->parent()->drawOpacityIsAnimating();
}
+ bool animatingTransformToTarget = layer->transformIsAnimating();
+ bool animatingTransformToScreen = animatingTransformToTarget;
+ if (layer->parent()) {
+ animatingTransformToTarget |= layer->parent()->drawTransformIsAnimating();
+ animatingTransformToScreen |= layer->parent()->screenSpaceTransformIsAnimating();
+ }
+
gfx::Size bounds = layer->bounds();
gfx::PointF anchorPoint = layer->anchorPoint();
gfx::PointF position = layer->position() - layer->scrollDelta();
@@ -506,7 +513,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
// The layer's contentsSize is determined from the combinedTransform, which then informs the
// layer's drawTransform.
- updateLayerContentsScale(layer, combinedTransform, deviceScaleFactor, pageScaleFactor);
+ updateLayerContentsScale(layer, combinedTransform, deviceScaleFactor, pageScaleFactor, animatingTransformToScreen);
// If there is a tranformation from the impl thread then it should be at the
// start of the combinedTransform, but we don't want it to affect the contentsScale.
@@ -535,13 +542,6 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
layerScreenSpaceTransform.multiply(drawTransform);
layer->setScreenSpaceTransform(layerScreenSpaceTransform);
- bool animatingTransformToTarget = layer->transformIsAnimating();
- bool animatingTransformToScreen = animatingTransformToTarget;
- if (layer->parent()) {
- animatingTransformToTarget |= layer->parent()->drawTransformIsAnimating();
- animatingTransformToScreen |= layer->parent()->screenSpaceTransformIsAnimating();
- }
-
gfx::RectF contentRect(gfx::PointF(), layer->contentBounds());
// fullHierarchyMatrix is the matrix that transforms objects between screen space (except projection matrix) and the most recent RenderSurfaceImpl's space.
« no previous file with comments | « cc/layer_animation_controller_unittest.cc ('k') | cc/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698