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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 323193002: cc: Don't cleanup the pending twin's low res tiling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: scale-collision: . Created 6 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/resources/picture_layer_tiling_set.cc » ('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 d380cfecd2cc47904b37217eb0136513f6119fbd..af9ee2d89742ac6b9f8fa886acbd87f701df11b7 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -2917,6 +2917,86 @@ TEST_F(NoLowResPictureLayerImplTest, CleanUpTilings) {
ASSERT_EQ(1u, active_layer_->tilings()->num_tilings());
}
+TEST_F(PictureLayerImplTest, ScaleCollision) {
+ gfx::Size tile_size(400, 400);
+ gfx::Size layer_bounds(1300, 1900);
+
+ scoped_refptr<FakePicturePileImpl> pending_pile =
+ FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
+ scoped_refptr<FakePicturePileImpl> active_pile =
+ FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
+
+ float result_scale_x, result_scale_y;
+ gfx::Size result_bounds;
+ std::vector<PictureLayerTiling*> used_tilings;
+
+ SetupTrees(pending_pile, active_pile);
+
+ float pending_contents_scale = 1.f;
+ float active_contents_scale = 2.f;
+ float device_scale_factor = 1.f;
+ float page_scale_factor = 1.f;
+ float maximum_animation_contents_scale = 1.f;
+ bool animating_transform = false;
+
+ EXPECT_TRUE(host_impl_.settings().create_low_res_tiling);
+ float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
+ EXPECT_LT(low_res_factor, 1.f);
+
+ pending_layer_->CalculateContentsScale(pending_contents_scale,
+ device_scale_factor,
+ page_scale_factor,
+ maximum_animation_contents_scale,
+ animating_transform,
+ &result_scale_x,
+ &result_scale_y,
+ &result_bounds);
+ active_layer_->CalculateContentsScale(active_contents_scale,
+ device_scale_factor,
+ page_scale_factor,
+ maximum_animation_contents_scale,
+ animating_transform,
+ &result_scale_x,
+ &result_scale_y,
+ &result_bounds);
+
+ ASSERT_EQ(4u, pending_layer_->tilings()->num_tilings());
+ ASSERT_EQ(4u, active_layer_->tilings()->num_tilings());
+
+ EXPECT_EQ(active_contents_scale,
+ pending_layer_->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_EQ(pending_contents_scale,
+ pending_layer_->tilings()->tiling_at(1)->contents_scale());
+ EXPECT_EQ(active_contents_scale * low_res_factor,
+ pending_layer_->tilings()->tiling_at(2)->contents_scale());
+ EXPECT_EQ(pending_contents_scale * low_res_factor,
+ pending_layer_->tilings()->tiling_at(3)->contents_scale());
+
+ EXPECT_EQ(active_contents_scale,
+ active_layer_->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_EQ(pending_contents_scale,
+ active_layer_->tilings()->tiling_at(1)->contents_scale());
+ EXPECT_EQ(active_contents_scale * low_res_factor,
+ active_layer_->tilings()->tiling_at(2)->contents_scale());
+ EXPECT_EQ(pending_contents_scale * low_res_factor,
+ active_layer_->tilings()->tiling_at(3)->contents_scale());
+
+ // The unused low res tiling from the pending tree must be kept or we may add
+ // it again on the active tree and collide with the pending tree.
+ used_tilings.push_back(active_layer_->tilings()->tiling_at(1));
+ active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
+ ASSERT_EQ(4u, active_layer_->tilings()->num_tilings());
+
+ EXPECT_EQ(active_contents_scale,
+ active_layer_->tilings()->tiling_at(0)->contents_scale());
+ EXPECT_EQ(pending_contents_scale,
+ active_layer_->tilings()->tiling_at(1)->contents_scale());
+ EXPECT_EQ(active_contents_scale * low_res_factor,
+ active_layer_->tilings()->tiling_at(2)->contents_scale());
+ EXPECT_EQ(pending_contents_scale * low_res_factor,
+ active_layer_->tilings()->tiling_at(3)->contents_scale());
+}
+
TEST_F(NoLowResPictureLayerImplTest, ReleaseResources) {
gfx::Size tile_size(400, 400);
gfx::Size layer_bounds(1300, 1900);
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/resources/picture_layer_tiling_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698