| 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 4da402a59ea9d8c312f1bc92fe7170745d785263..747d9cd27e472a4792275900000761a936308610 100644
|
| --- a/cc/layers/picture_layer_impl_unittest.cc
|
| +++ b/cc/layers/picture_layer_impl_unittest.cc
|
| @@ -2128,6 +2128,111 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForCpuRasterization) {
|
| EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 11.f);
|
| }
|
|
|
| +TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForGpuRasterization) {
|
| + gfx::Size layer_bounds(100, 100);
|
| + gfx::Size viewport_size(1000, 1000);
|
| + SetupDefaultTrees(layer_bounds);
|
| + host_impl_.SetViewportSize(viewport_size);
|
| + host_impl_.SetUseGpuRasterization(true);
|
| +
|
| + float contents_scale = 1.f;
|
| + float device_scale = 1.3f;
|
| + float page_scale = 1.4f;
|
| + float maximum_animation_scale = 1.f;
|
| + bool animating_transform = false;
|
| +
|
| + SetContentsScaleOnBothLayers(contents_scale,
|
| + device_scale,
|
| + page_scale,
|
| + maximum_animation_scale,
|
| + animating_transform);
|
| + EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f);
|
| +
|
| + // Since we're GPU-rasterizing, starting an animation should cause tiling
|
| + // resolution to get set to the current contents scale.
|
| + animating_transform = true;
|
| + contents_scale = 2.f;
|
| + maximum_animation_scale = 4.f;
|
| +
|
| + SetContentsScaleOnBothLayers(contents_scale,
|
| + device_scale,
|
| + page_scale,
|
| + maximum_animation_scale,
|
| + animating_transform);
|
| + EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
|
| +
|
| + // Further changes to scale during the animation should cause a new high-res
|
| + // tiling to get created.
|
| + contents_scale = 3.f;
|
| +
|
| + SetContentsScaleOnBothLayers(contents_scale,
|
| + device_scale,
|
| + page_scale,
|
| + maximum_animation_scale,
|
| + animating_transform);
|
| + EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f);
|
| +
|
| + // Since we're re-rasterizing during the animation, scales smaller than 1
|
| + // should be respected.
|
| + contents_scale = 0.25f;
|
| +
|
| + SetContentsScaleOnBothLayers(contents_scale,
|
| + device_scale,
|
| + page_scale,
|
| + maximum_animation_scale,
|
| + animating_transform);
|
| + EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 0.25f);
|
| +
|
| + // Once we stop animating, a new high-res tiling should be created.
|
| + contents_scale = 4.f;
|
| + animating_transform = false;
|
| +
|
| + SetContentsScaleOnBothLayers(contents_scale,
|
| + device_scale,
|
| + page_scale,
|
| + maximum_animation_scale,
|
| + animating_transform);
|
| + EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f);
|
| +
|
| + static_cast<FakePicturePileImpl*>(pending_layer_->pile())->set_has_text(true);
|
| + static_cast<FakePicturePileImpl*>(active_layer_->pile())->set_has_text(true);
|
| +
|
| + // Since we're GPU-rasterizing but have text, starting an animation should
|
| + // cause tiling resolution to get set to the maximum animation scale.
|
| + animating_transform = true;
|
| + contents_scale = 2.f;
|
| + maximum_animation_scale = 3.f;
|
| +
|
| + SetContentsScaleOnBothLayers(contents_scale,
|
| + device_scale,
|
| + page_scale,
|
| + maximum_animation_scale,
|
| + animating_transform);
|
| + EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f);
|
| +
|
| + // Further changes to scale during the animation should not cause a new
|
| + // high-res tiling to get created.
|
| + contents_scale = 4.f;
|
| + maximum_animation_scale = 5.f;
|
| +
|
| + SetContentsScaleOnBothLayers(contents_scale,
|
| + device_scale,
|
| + page_scale,
|
| + maximum_animation_scale,
|
| + animating_transform);
|
| + EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f);
|
| +
|
| + // Once we stop animating, a new high-res tiling should be created.
|
| + animating_transform = false;
|
| +
|
| + SetContentsScaleOnBothLayers(contents_scale,
|
| + device_scale,
|
| + page_scale,
|
| + maximum_animation_scale,
|
| + animating_transform);
|
| + EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f);
|
| +}
|
| +
|
| TEST_F(PictureLayerImplTest, LayerRasterTileIterator) {
|
| gfx::Size tile_size(100, 100);
|
| gfx::Size layer_bounds(1000, 1000);
|
|
|