Commit d0a11b12 authored by danakj's avatar danakj Committed by Commit bot

cc: Invalidate all new recorded pixels when a layer grows.

Previously we invalidated only new recorded pixels on tiles that
resized but ignored new recording tiles. The problem with this is that
if the old layer size is on the boundary of recording tiles, then we
invalidate nothing. But there may be raster tiles that would like to
use the new recording tiles, and currently have uninitialized content
in them, but they don't get invalidated to hear about it.

R=vmpstr
BUG=411774

Review URL: https://codereview.chromium.org/556973003

Cr-Commit-Position: refs/heads/master@{#294203}
parent 7c56c17a
......@@ -323,7 +323,9 @@ bool PicturePile::UpdateAndExpandInvalidation(
int bottom_until = std::max(interest_rect_over_tiles.bottom(), top);
int exposed_left = old_tiling_size.width();
int exposed_left_until = right;
int exposed_left_until = tiling_size().width();
int exposed_top = top;
int exposed_bottom = tiling_size().height();
DCHECK_GE(exposed_left, left);
gfx::Rect left_rect(left, top, left_until - left, bottom - top);
......@@ -331,8 +333,10 @@ bool PicturePile::UpdateAndExpandInvalidation(
gfx::Rect top_rect(left, top, right - left, top_until - top);
gfx::Rect bottom_rect(
left, bottom_until, right - left, bottom - bottom_until);
gfx::Rect exposed_rect(
exposed_left, top, exposed_left_until - exposed_left, bottom - top);
gfx::Rect exposed_rect(exposed_left,
exposed_top,
exposed_left_until - exposed_left,
exposed_bottom - exposed_top);
resize_invalidation.Union(left_rect);
resize_invalidation.Union(right_rect);
resize_invalidation.Union(top_rect);
......@@ -355,7 +359,9 @@ bool PicturePile::UpdateAndExpandInvalidation(
int right_until = std::max(interest_rect_over_tiles.right(), left);
int exposed_top = old_tiling_size.height();
int exposed_top_until = bottom;
int exposed_top_until = tiling_size().height();
int exposed_left = left;
int exposed_right = tiling_size().width();
DCHECK_GE(exposed_top, top);
gfx::Rect left_rect(left, top, left_until - left, bottom - top);
......@@ -363,8 +369,10 @@ bool PicturePile::UpdateAndExpandInvalidation(
gfx::Rect top_rect(left, top, right - left, top_until - top);
gfx::Rect bottom_rect(
left, bottom_until, right - left, bottom - bottom_until);
gfx::Rect exposed_rect(
left, exposed_top, right - left, exposed_top_until - exposed_top);
gfx::Rect exposed_rect(exposed_left,
exposed_top,
exposed_right - exposed_left,
exposed_top_until - exposed_top);
resize_invalidation.Union(left_rect);
resize_invalidation.Union(right_rect);
resize_invalidation.Union(top_rect);
......
......@@ -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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment