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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 605773004: CC: Tile-size cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add tests. Created 6 years, 2 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
« cc/layers/picture_layer_impl.cc ('K') | « cc/layers/picture_layer_impl.cc ('k') | no next file » | 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 4406450b165448c014e6b7d2ce88fb940520c06b..92d802975130b6ea777b2c7b9b9d205d672e088b 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -4367,5 +4367,65 @@ TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) {
EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
}
+class TileSizeSettings : public ImplSidePaintingSettings {
+ public:
+ TileSizeSettings() {
+ default_tile_size = gfx::Size(100, 100);
+ max_untiled_layer_size = gfx::Size(200, 200);
+ }
+};
+
+class TileSizeTest : public PictureLayerImplTest {
+ public:
+ TileSizeTest() : PictureLayerImplTest(TileSizeSettings()) {}
+};
+
+TEST_F(TileSizeTest, TileSizes) {
+ host_impl_.CreatePendingTree();
+
+ LayerTreeImpl* pending_tree = host_impl_.pending_tree();
+ scoped_ptr<FakePictureLayerImpl> layer =
+ FakePictureLayerImpl::Create(pending_tree, id_);
+
+ gfx::Size viewport_size = gfx::Size(1000, 1000);
+ gfx::Size gpu_tile_size = gfx::Size(1000, 250);
+ gfx::Size small_layer_size(42, 42);
+ gfx::Size medium_layer_size(260, 260);
+ gfx::Size large_layer_size(10000, 10000);
+ host_impl_.SetViewportSize(viewport_size);
+ gfx::Size result;
+
+ host_impl_.SetUseGpuRasterization(false);
+
+ // Default tile-size for large layers.
+ result = layer->CalculateTileSize(large_layer_size);
+ EXPECT_EQ(result.width(), 100);
+ EXPECT_EQ(result.height(), 100);
+
+ // Small layers don't tile if under max_untiled_layer_size.
+ // Small layers also round up to multiples of 64.
+ result = layer->CalculateTileSize(small_layer_size);
+ EXPECT_EQ(result.width(), 64);
+ EXPECT_EQ(result.height(), 64);
+
+ host_impl_.SetUseGpuRasterization(true);
+
+ // Gpu-rasterization uses 1/4 viewport-height tiles.
+ result = layer->CalculateTileSize(large_layer_size);
+ EXPECT_EQ(result.width(), gpu_tile_size.width());
+ EXPECT_EQ(result.height(), gpu_tile_size.height());
+
+ // Same as non-gpu small layers.
+ result = layer->CalculateTileSize(small_layer_size);
+ EXPECT_EQ(result.width(), 64);
+ EXPECT_EQ(result.height(), 64);
+
+ // The max untiled size for gpu-raster is 2x a normal tile.
+ // These are also rounded up to multiples of 64.
+ result = layer->CalculateTileSize(medium_layer_size);
+ EXPECT_EQ(result.width(), 320);
+ EXPECT_EQ(result.height(), 320);
+}
+
} // namespace
} // namespace cc
« cc/layers/picture_layer_impl.cc ('K') | « cc/layers/picture_layer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698