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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 294463002: cc: Reset raster scale if we didn't sync high res tiling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: +test Created 6 years, 7 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.h » ('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 bdbe172213f67d122434c37a303c3dcd07c8a83e..786b1895885f6d9ee8889f5ca7b877951964767f 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -1727,6 +1727,53 @@ TEST_F(PictureLayerImplTest, SyncTilingAfterReleaseResource) {
EXPECT_EQ(HIGH_RESOLUTION, high_res->resolution());
}
+TEST_F(PictureLayerImplTest, HighResCreatedWhenBoundsShrink) {
+ SetupDefaultTrees(gfx::Size(10, 10));
+ host_impl_.active_tree()->UpdateDrawProperties();
+ EXPECT_FALSE(host_impl_.active_tree()->needs_update_draw_properties());
+
+ float result_scale_x;
+ float result_scale_y;
+ gfx::Size result_bounds;
+ active_layer_->CalculateContentsScale(0.5f,
+ 0.5f,
+ 0.5f,
+ 0.5f,
+ false,
+ &result_scale_x,
+ &result_scale_y,
+ &result_bounds);
+ active_layer_->tilings()->RemoveAllTilings();
+ PictureLayerTiling* tiling = active_layer_->tilings()->AddTiling(0.5f);
+ active_layer_->tilings()->AddTiling(1.5f);
+ active_layer_->tilings()->AddTiling(0.25f);
+ tiling->set_resolution(HIGH_RESOLUTION);
+
+ // Sanity checks.
+ ASSERT_EQ(3u, active_layer_->tilings()->num_tilings());
+ ASSERT_EQ(tiling, active_layer_->tilings()->TilingAtScale(0.5f));
+
+ // Ensure we need post commit initialization on the pending layer.
enne (OOO) 2014/05/19 22:27:36 This is a very informative comment. Maybe say you
vmpstr 2014/05/19 22:46:28 Done.
+ pending_layer_->SetNeedsPostCommitInitialization();
+ pending_layer_->set_twin_layer(NULL);
+ active_layer_->set_twin_layer(NULL);
+ EXPECT_TRUE(pending_layer_->needs_post_commit_initialization());
+
+ pending_layer_->SetBounds(gfx::Size(1, 1));
+ host_impl_.pending_tree()->UpdateDrawProperties();
+
+ // Another sanity check.
+ ASSERT_EQ(1.f, pending_layer_->MinimumContentsScale());
+
+ EXPECT_EQ(2u, pending_layer_->tilings()->num_tilings());
+ ASSERT_TRUE(pending_layer_->tilings()->TilingAtScale(1.0f));
+ EXPECT_EQ(HIGH_RESOLUTION,
+ pending_layer_->tilings()->TilingAtScale(1.0f)->resolution());
+ ASSERT_TRUE(pending_layer_->tilings()->TilingAtScale(1.5f));
+ EXPECT_EQ(NON_IDEAL_RESOLUTION,
+ pending_layer_->tilings()->TilingAtScale(1.5f)->resolution());
+}
+
TEST_F(PictureLayerImplTest, NoLowResTilingWithGpuRasterization) {
gfx::Size default_tile_size(host_impl_.settings().default_tile_size);
gfx::Size layer_bounds(default_tile_size.width() * 4,
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/resources/picture_layer_tiling_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698