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

Unified Diff: cc/tiles/picture_layer_tiling_unittest.cc

Issue 1894943002: Have pending and active tree use the same space for invalidations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/tiles/picture_layer_tiling.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/picture_layer_tiling_unittest.cc
diff --git a/cc/tiles/picture_layer_tiling_unittest.cc b/cc/tiles/picture_layer_tiling_unittest.cc
index 631845f9a05992900f732e56fc4bfed5f36824b1..e4d5d6da7a4efa6804098d69a1425cdb2db5cd38 100644
--- a/cc/tiles/picture_layer_tiling_unittest.cc
+++ b/cc/tiles/picture_layer_tiling_unittest.cc
@@ -472,6 +472,46 @@ TEST_F(PictureLayerTilingIteratorTest, RemoveOutsideLayerKeepsTiles) {
EXPECT_TRUE(tiling_->TileAt(0, 0));
}
+TEST_F(PictureLayerTilingIteratorTest, CreateTileJustCoverBorderUp) {
+ float content_scale = 1.2000000476837158f;
+ gfx::Size tile_size(512, 512);
+ gfx::Size layer_size(1440, 4560);
+ FakePictureLayerTilingClient active_client;
+
+ active_client.SetTileSize(tile_size);
+ scoped_refptr<FakeRasterSource> raster_source =
+ FakeRasterSource::CreateFilled(layer_size);
+ std::unique_ptr<TestablePictureLayerTiling> active_tiling =
+ TestablePictureLayerTiling::Create(ACTIVE_TREE, content_scale,
+ raster_source, &active_client,
+ LayerTreeSettings());
+ active_tiling->set_resolution(HIGH_RESOLUTION);
+
+ gfx::Rect invalid_rect(0, 750, 220, 100);
+ Initialize(tile_size, content_scale, layer_size);
+ client_.set_twin_tiling(active_tiling.get());
+ client_.set_invalidation(invalid_rect);
+ SetLiveRectAndVerifyTiles(gfx::Rect(layer_size));
+ // When it creates a tile in pending tree, verify that tiles are invalidated
+ // even if only their border pixels intersect the invalidation rect
+ EXPECT_TRUE(tiling_->TileAt(0, 1));
+ gfx::Rect scaled_invalid_rect =
+ gfx::ScaleToEnclosingRect(invalid_rect, content_scale);
+ EXPECT_FALSE(scaled_invalid_rect.Intersects(
+ tiling_->TilingDataForTesting().TileBounds(0, 2)));
+ EXPECT_TRUE(scaled_invalid_rect.Intersects(
+ tiling_->TilingDataForTesting().TileBoundsWithBorder(0, 2)));
+ EXPECT_TRUE(tiling_->TileAt(0, 2));
+
+ bool recreate_tiles = false;
+ active_tiling->RemoveTilesInRegion(invalid_rect, recreate_tiles);
+ // Even though a tile just touch border area of invalid region, verify that
+ // RemoveTilesInRegion behaves the same as SetLiveRectAndVerifyTiles with
+ // respect to the tiles that it invalidates
+ EXPECT_FALSE(active_tiling->TileAt(0, 1));
+ EXPECT_FALSE(active_tiling->TileAt(0, 2));
+}
+
TEST_F(PictureLayerTilingIteratorTest, LiveTilesExactlyCoverLiveTileRect) {
Initialize(gfx::Size(100, 100), 1.f, gfx::Size(1099, 801));
SetLiveRectAndVerifyTiles(gfx::Rect(100, 100));
« no previous file with comments | « cc/tiles/picture_layer_tiling.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698