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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 547463002: cc: Don't make tiles for mask layers that are too big for a texture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: hugemasks: . Created 6 years, 3 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
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 ba6c6bbbe2f618ff952b3993f1da87c74ffbf77c..653f8961e7c1e00c968aa2ca219af17443e86c8c 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -1166,6 +1166,58 @@ TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) {
EXPECT_BOTH_EQ(num_tilings(), 1u);
}
+TEST_F(PictureLayerImplTest, HugeMasksDontGetTiles) {
+ gfx::Size tile_size(host_impl_.settings().default_tile_size);
+ SetupDefaultTrees(tile_size);
+
+ float contents_scale = 1.f;
+ float device_scale = 1.f;
+ float page_scale = 1.f;
+ float maximum_animation_scale = 1.f;
+ bool animating_transform = false;
+
+ pending_layer_->SetIsMask(true);
+ active_layer_->SetIsMask(true);
+ SetContentsScaleOnBothLayers(contents_scale,
+ device_scale,
+ page_scale,
+ maximum_animation_scale,
+ animating_transform);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale);
+ EXPECT_BOTH_EQ(num_tilings(), 1u);
+
+ pending_layer_->HighResTiling()->CreateAllTilesForTesting();
+ active_layer_->HighResTiling()->CreateAllTilesForTesting();
+
+ // Mask layers have a tiling with a single tile in it.
+ EXPECT_BOTH_EQ(HighResTiling()->AllTilesForTesting().size(), 1u);
+
+ ResetTilingsAndRasterScales();
+
+ int max_texture_size = host_impl_.GetRendererCapabilities().max_texture_size;
+ EXPECT_LE(pending_layer_->bounds().width(), max_texture_size);
+ EXPECT_LE(pending_layer_->bounds().height(), max_texture_size);
+ EXPECT_LE(active_layer_->bounds().width(), max_texture_size);
+ EXPECT_LE(active_layer_->bounds().height(), max_texture_size);
+
+ pending_layer_->SetBounds(gfx::Size(max_texture_size + 1, 10));
+ active_layer_->SetBounds(gfx::Size(10, max_texture_size + 1));
+
+ SetContentsScaleOnBothLayers(contents_scale,
+ device_scale,
+ page_scale,
+ maximum_animation_scale,
+ animating_transform);
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale);
+ EXPECT_BOTH_EQ(num_tilings(), 1u);
+
+ pending_layer_->HighResTiling()->CreateAllTilesForTesting();
+ active_layer_->HighResTiling()->CreateAllTilesForTesting();
+
+ // Mask layers have a tiling, but there should be no tiles in it.
+ EXPECT_BOTH_EQ(HighResTiling()->AllTilesForTesting().size(), 1u);
enne (OOO) 2014/09/05 17:41:46 "there should be no tiles" but 1u? Also, can you
danakj 2014/09/05 22:09:52 Oh snap, thanks. My test is bad and I feel bad.
+}
+
TEST_F(PictureLayerImplTest, ReleaseResources) {
gfx::Size tile_size(400, 400);
gfx::Size layer_bounds(1300, 1900);

Powered by Google App Engine
This is Rietveld 408576698