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

Unified Diff: cc/resources/picture_pile_unittest.cc

Issue 556973003: cc: Invalidate all new recorded pixels when a layer grows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: invalidateraster: review 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
« no previous file with comments | « cc/resources/picture_pile.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/picture_pile_unittest.cc
diff --git a/cc/resources/picture_pile_unittest.cc b/cc/resources/picture_pile_unittest.cc
index 14c7393c4038483aaab28f26b9c0b1e5779b0710..a27c8a5c2c2db61e1abfc1231c211e31d314b8b1 100644
--- a/cc/resources/picture_pile_unittest.cc
+++ b/cc/resources/picture_pile_unittest.cc
@@ -472,9 +472,15 @@ TEST_P(PicturePileResizeCornerTest, ResizePileOutsideInterestRect) {
}
}
- // We invalidated the old bottom row.
- expected_invalidation = gfx::UnionRects(pile_->tiling().TileBounds(0, 5),
- pile_->tiling().TileBounds(5, 5));
+ // We invalidated all new pixels in the recording.
+ expected_invalidation = SubtractRegions(gfx::Rect(grow_down_tiling_size),
+ gfx::Rect(base_tiling_size));
+ // But the new pixels don't cover the whole bottom row.
+ gfx::Rect bottom_row = gfx::UnionRects(pile_->tiling().TileBounds(0, 5),
+ pile_->tiling().TileBounds(5, 5));
+ EXPECT_FALSE(expected_invalidation.Contains(bottom_row));
+ // We invalidated the entire old bottom row.
+ expected_invalidation.Union(bottom_row);
EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString());
invalidation.Clear();
@@ -518,9 +524,15 @@ TEST_P(PicturePileResizeCornerTest, ResizePileOutsideInterestRect) {
}
}
- // We invalidated the old right column.
- expected_invalidation = gfx::UnionRects(pile_->tiling().TileBounds(5, 0),
- pile_->tiling().TileBounds(5, 5));
+ // We invalidated all new pixels in the recording.
+ expected_invalidation = SubtractRegions(gfx::Rect(grow_right_tiling_size),
+ gfx::Rect(base_tiling_size));
+ // But the new pixels don't cover the whole right_column.
+ gfx::Rect right_column = gfx::UnionRects(pile_->tiling().TileBounds(5, 0),
+ pile_->tiling().TileBounds(5, 5));
+ EXPECT_FALSE(expected_invalidation.Contains(right_column));
+ // We invalidated the entire old right column.
+ expected_invalidation.Union(right_column);
EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString());
invalidation.Clear();
@@ -564,11 +576,18 @@ TEST_P(PicturePileResizeCornerTest, ResizePileOutsideInterestRect) {
}
}
- // We invalidated the old right column and the old bottom row.
- expected_invalidation = gfx::UnionRects(pile_->tiling().TileBounds(5, 0),
- pile_->tiling().TileBounds(5, 5));
- expected_invalidation.Union(gfx::UnionRects(
- pile_->tiling().TileBounds(0, 5), pile_->tiling().TileBounds(5, 5)));
+ // We invalidated all new pixels in the recording.
+ expected_invalidation = SubtractRegions(gfx::Rect(grow_both_tiling_size),
+ gfx::Rect(base_tiling_size));
+ // But the new pixels don't cover the whole right_column.
+ Region right_column_and_bottom_row =
+ UnionRegions(gfx::UnionRects(pile_->tiling().TileBounds(5, 0),
+ pile_->tiling().TileBounds(5, 5)),
+ gfx::UnionRects(pile_->tiling().TileBounds(0, 5),
+ pile_->tiling().TileBounds(5, 5)));
+ EXPECT_FALSE(expected_invalidation.Contains(right_column_and_bottom_row));
+ // We invalidated the entire old right column and the old bottom row.
+ expected_invalidation.Union(right_column_and_bottom_row);
EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString());
invalidation.Clear();
@@ -934,9 +953,13 @@ TEST_F(PicturePileTest, ResizePileInsideInterestRect) {
}
// We invalidated the newly exposed pixels on the bottom row of tiles.
- expected_invalidation = gfx::UnionRects(pile_->tiling().TileBounds(0, 5),
- pile_->tiling().TileBounds(5, 5));
- expected_invalidation.Subtract(gfx::Rect(base_tiling_size));
+ expected_invalidation = SubtractRegions(gfx::Rect(grow_down_tiling_size),
+ gfx::Rect(base_tiling_size));
+ Region bottom_row_new_pixels =
+ SubtractRegions(gfx::UnionRects(pile_->tiling().TileBounds(0, 5),
+ pile_->tiling().TileBounds(5, 5)),
+ gfx::Rect(base_tiling_size));
+ EXPECT_TRUE(expected_invalidation.Contains(bottom_row_new_pixels));
EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString());
invalidation.Clear();
@@ -976,9 +999,13 @@ TEST_F(PicturePileTest, ResizePileInsideInterestRect) {
}
// We invalidated the newly exposed pixels on the right column of tiles.
- expected_invalidation = gfx::UnionRects(pile_->tiling().TileBounds(5, 0),
- pile_->tiling().TileBounds(5, 5));
- expected_invalidation.Subtract(gfx::Rect(base_tiling_size));
+ expected_invalidation = SubtractRegions(gfx::Rect(grow_right_tiling_size),
+ gfx::Rect(base_tiling_size));
+ Region right_column_new_pixels =
+ SubtractRegions(gfx::UnionRects(pile_->tiling().TileBounds(5, 0),
+ pile_->tiling().TileBounds(5, 5)),
+ gfx::Rect(base_tiling_size));
+ EXPECT_TRUE(expected_invalidation.Contains(right_column_new_pixels));
EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString());
invalidation.Clear();
@@ -1019,12 +1046,16 @@ TEST_F(PicturePileTest, ResizePileInsideInterestRect) {
// We invalidated the newly exposed pixels on the bottom row and right column
// of tiles.
- expected_invalidation =
- UnionRegions(gfx::UnionRects(pile_->tiling().TileBounds(5, 0),
+ expected_invalidation = SubtractRegions(gfx::Rect(grow_both_tiling_size),
+ gfx::Rect(base_tiling_size));
+ Region bottom_row_and_right_column_new_pixels = SubtractRegions(
+ UnionRegions(gfx::UnionRects(pile_->tiling().TileBounds(0, 5),
pile_->tiling().TileBounds(5, 5)),
- gfx::UnionRects(pile_->tiling().TileBounds(0, 5),
- pile_->tiling().TileBounds(5, 5)));
- expected_invalidation.Subtract(gfx::Rect(base_tiling_size));
+ gfx::UnionRects(pile_->tiling().TileBounds(5, 0),
+ pile_->tiling().TileBounds(5, 5))),
+ gfx::Rect(base_tiling_size));
+ EXPECT_TRUE(
+ expected_invalidation.Contains(bottom_row_and_right_column_new_pixels));
EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString());
invalidation.Clear();
« no previous file with comments | « cc/resources/picture_pile.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698