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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 420523002: cc: Don't rasterize large layers at maximum scale before scale animations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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/layers/picture_layer_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/picture_layer_impl_unittest.cc
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index cd40152dfe1b48ec2369d1c5ac0a361dca5c47e5..cdd0b92de09c29b7da448d0bfaf5c2332f0913fa 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -1863,8 +1863,10 @@ TEST_F(DeferredInitPictureLayerImplTest, PreventUpdateTilesDuringLostContext) {
}
TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForCpuRasterization) {
- gfx::Size tile_size(host_impl_.settings().default_tile_size);
- SetupDefaultTrees(tile_size);
+ gfx::Size layer_bounds(100, 100);
+ gfx::Size viewport_size(1000, 1000);
+ SetupDefaultTrees(layer_bounds);
+ host_impl_.SetViewportSize(viewport_size);
float contents_scale = 1.f;
float device_scale = 1.3f;
@@ -1948,6 +1950,58 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForCpuRasterization) {
maximum_animation_scale,
animating_transform);
EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f);
+
+ // When animating with a maxmium animation scale factor that is so large
+ // that the layer grows larger than the viewport at this scale, a new
+ // high-res tiling should get created at the animation's initial scale, not
+ // at its maximum scale.
+ animating_transform = true;
+ contents_scale = 2.f;
+ maximum_animation_scale = 11.f;
+
+ SetContentsScaleOnBothLayers(contents_scale,
+ device_scale,
+ page_scale,
+ maximum_animation_scale,
+ animating_transform);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
+
+ // Once we stop animating, a new high-res tiling should be created.
+ animating_transform = false;
+ contents_scale = 11.f;
+
+ SetContentsScaleOnBothLayers(contents_scale,
+ device_scale,
+ page_scale,
+ maximum_animation_scale,
+ animating_transform);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 11.f);
+
+ // When animating with a maxmium animation scale factor that is so large
+ // that the layer grows larger than the viewport at this scale, and where
+ // the intial source scale is < 1, a new high-res tiling should get created
+ // at source scale 1.
+ animating_transform = true;
+ contents_scale = 0.1f;
+ maximum_animation_scale = 11.f;
+
+ SetContentsScaleOnBothLayers(contents_scale,
+ device_scale,
+ page_scale,
+ maximum_animation_scale,
+ animating_transform);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), device_scale * page_scale);
+
+ // Once we stop animating, a new high-res tiling should be created.
+ animating_transform = false;
+ contents_scale = 11.f;
+
+ SetContentsScaleOnBothLayers(contents_scale,
+ device_scale,
+ page_scale,
+ maximum_animation_scale,
+ animating_transform);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 11.f);
}
TEST_F(PictureLayerImplTest, LayerRasterTileIterator) {
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698