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

Unified Diff: cc/layer_tree_host_common_unittest.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_tree_host_common.cc ('k') | cc/test/animation_test_common.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_common_unittest.cc
diff --git a/cc/layer_tree_host_common_unittest.cc b/cc/layer_tree_host_common_unittest.cc
index 228ce2b6e5b7cf4cc4e8f5a6a7bf61e73cde12c3..3b21f30e02c03cd0e12ca3c0dc3ed46878141450 100644
--- a/cc/layer_tree_host_common_unittest.cc
+++ b/cc/layer_tree_host_common_unittest.cc
@@ -3876,6 +3876,50 @@ TEST(LayerTreeHostCommonTest, verifyContentsScaleForSurfaces)
EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale * initialChildScale, surfaceNoAutoScaleChildNoScale->drawTransform().m22());
}
+TEST(LayerTreeHostCommonTest, verifyContentsScaleForAnimatingLayer)
+{
+ MockContentLayerClient delegate;
+ WebTransformationMatrix identityMatrix;
+
+ WebTransformationMatrix parentScaleMatrix;
+ const double initialParentScale = 1.75;
+ parentScaleMatrix.scale(initialParentScale);
+
+ WebTransformationMatrix childScaleMatrix;
+ const double initialChildScale = 1.25;
+ childScaleMatrix.scale(initialChildScale);
+
+ scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate);
+ setLayerPropertiesForTesting(parent.get(), parentScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true);
+
+ scoped_refptr<ContentLayer> childScale = createDrawableContentLayer(&delegate);
+ setLayerPropertiesForTesting(childScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true);
+
+ parent->addChild(childScale);
+
+ // Now put an animating transform on child.
+ int animationId = addAnimatedTransformToController(*childScale->layerAnimationController(), 10, 30, 0);
+
+ std::vector<scoped_refptr<Layer> > renderSurfaceLayerList;
+ int dummyMaxTextureSize = 512;
+
+ LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
+
+ EXPECT_CONTENTS_SCALE_EQ(initialParentScale, parent);
+ // The layers with animating transforms should not compute a contentsScale other than 1 until they finish animating.
+ EXPECT_CONTENTS_SCALE_EQ(1, childScale);
+
+ // Remove the animation, now it can save a raster scale.
+ childScale->layerAnimationController()->removeAnimation(animationId);
+
+ LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
+
+ EXPECT_CONTENTS_SCALE_EQ(initialParentScale, parent);
+ // The layers with animating transforms should not compute a contentsScale other than 1 until they finish animating.
+ EXPECT_CONTENTS_SCALE_EQ(initialParentScale * initialChildScale, childScale);
+}
+
+
TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI)
{
MockContentLayerClient delegate;
« no previous file with comments | « cc/layer_tree_host_common.cc ('k') | cc/test/animation_test_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698