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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 2068413002: cc: Remove fixed raster scale, stop rasterizing with will-change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 years, 6 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') | cc/proto/begin_main_frame_and_commit_state.proto » ('j') | 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 61ac6bb99b8dd4d47431757071940e6e5532e8dc..399639bda894334a432038bc39c3cd9405a47979 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -925,6 +925,7 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
float page_scale = 1.f;
SetupDefaultTrees(layer_bounds);
+ active_layer()->SetHasWillChangeTransformHint(true);
danakj 2016/06/16 18:15:29 What do you think of the test changes in https://c
EXPECT_EQ(2u, active_layer()->tilings()->num_tilings());
EXPECT_EQ(1.f, active_layer()->HighResTiling()->contents_scale());
@@ -1829,6 +1830,7 @@ TEST_F(PictureLayerImplTest,
SetInitialDeviceScaleFactor(2.f);
SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, Region());
+ active_layer()->SetHasWillChangeTransformHint(true);
// One ideal tile exists, this will get used when drawing.
std::vector<Tile*> ideal_tiles;
@@ -3119,22 +3121,53 @@ TEST_F(PictureLayerImplTest, RasterScaleChangeWithoutAnimation) {
EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
// Changing the source scale without being in an animation will cause
- // the layer to reset its source scale to 1.f.
+ // the layer to change scale.
contents_scale = 3.f;
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f);
+
+ contents_scale = 0.5f;
+
+ SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
+ maximum_animation_scale,
+ starting_animation_scale, animating_transform);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 0.5f);
+
+ // However, if the layer has a will-change property, then the raster scale
+ // will get fixed at the last value.
+ active_layer()->SetHasWillChangeTransformHint(true);
+ pending_layer()->SetHasWillChangeTransformHint(true);
+
+ contents_scale = 3.f;
+
+ SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
+ maximum_animation_scale,
+ starting_animation_scale, animating_transform);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 0.5f);
// Further changes to the source scale will no longer be reflected in the
// contents scale.
- contents_scale = 0.5f;
+ contents_scale = 1.f;
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
maximum_animation_scale,
starting_animation_scale, animating_transform);
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 0.5f);
+
+ // Disabling the will-change hint will once again make the raster scale update
+ // with the ideal scale.
+ active_layer()->SetHasWillChangeTransformHint(false);
+ pending_layer()->SetHasWillChangeTransformHint(false);
+
+ contents_scale = 3.f;
+
+ SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
+ maximum_animation_scale,
+ starting_animation_scale, animating_transform);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f);
}
TEST_F(PictureLayerImplTest, LowResReadyToDrawNotEnoughToActivate) {
@@ -3385,6 +3418,7 @@ TEST_F(NoLowResPictureLayerImplTest, CleanUpTilings) {
float page_scale = 3.2f;
float scale = 1.f;
+ active_layer()->SetHasWillChangeTransformHint(true);
ResetTilingsAndRasterScales();
SetContentsScaleOnBothLayers(scale, device_scale, page_scale, 1.f, 0.f,
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/proto/begin_main_frame_and_commit_state.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698