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

Unified Diff: cc/resources/picture_pile.cc

Issue 672663002: cc: Correct expansion of invalidation for tiles outside of interest rect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2171
Patch Set: 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
« no previous file with comments | « cc/resources/picture_pile.h ('k') | cc/resources/picture_pile_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/picture_pile.cc
diff --git a/cc/resources/picture_pile.cc b/cc/resources/picture_pile.cc
index 402d1a530a12421f313c471396731ae3ed23adf7..641af5fe0ed4ef4c3e67cc53d9b2261275e68527 100644
--- a/cc/resources/picture_pile.cc
+++ b/cc/resources/picture_pile.cc
@@ -149,7 +149,9 @@ float ClusterTiles(const std::vector<gfx::Rect>& invalid_tiles,
namespace cc {
-PicturePile::PicturePile() : is_suitable_for_gpu_rasterization_(true) {
+PicturePile::PicturePile()
+ : is_suitable_for_gpu_rasterization_(true),
+ pixel_record_distance_(kPixelDistanceToRecord) {
}
PicturePile::~PicturePile() {
@@ -180,11 +182,7 @@ bool PicturePile::UpdateAndExpandInvalidation(
}
gfx::Rect interest_rect = visible_layer_rect;
- interest_rect.Inset(
- -kPixelDistanceToRecord,
- -kPixelDistanceToRecord,
- -kPixelDistanceToRecord,
- -kPixelDistanceToRecord);
+ interest_rect.Inset(-pixel_record_distance_, -pixel_record_distance_);
recorded_viewport_ = interest_rect;
recorded_viewport_.Intersect(gfx::Rect(tiling_size()));
@@ -385,23 +383,31 @@ bool PicturePile::UpdateAndExpandInvalidation(
for (auto& it : picture_map_)
updated = it.second.Invalidate(frame_number) || updated;
} else {
- // Expand invalidation that is outside tiles that intersect the interest
- // rect. These tiles are no longer valid and should be considerered fully
- // invalid, so we can know to not keep around raster tiles that intersect
- // with these recording tiles.
+ // Expand invalidation that is on tiles that aren't in the interest rect and
+ // will not be re-recorded below. These tiles are no longer valid and should
+ // be considerered fully invalid, so we can know to not keep around raster
+ // tiles that intersect with these recording tiles.
Region invalidation_expanded_to_full_tiles;
for (Region::Iterator i(*invalidation); i.has_rect(); i.next()) {
gfx::Rect invalid_rect = i.rect();
- gfx::Rect invalid_rect_outside_interest_rect_tiles = invalid_rect;
+ // This rect covers the bounds (excluding borders) of all tiles whose
+ // bounds (including borders) touch the |interest_rect|. This matches
+ // the iteration of the |invalid_rect| below which includes borders when
+ // calling Invalidate() on pictures.
+ gfx::Rect invalid_rect_outside_interest_rect_tiles =
+ tiling_.ExpandRectToTileBounds(invalid_rect);
+ // We subtract the |interest_rect_over_tiles| which represents the bounds
+ // of tiles that will be re-recorded below. This matches the iteration of
+ // |interest_rect| below which includes borders.
// TODO(danakj): We should have a Rect-subtract-Rect-to-2-rects operator
// instead of using Rect::Subtract which gives you the bounding box of the
// subtraction.
invalid_rect_outside_interest_rect_tiles.Subtract(
interest_rect_over_tiles);
- invalidation_expanded_to_full_tiles.Union(tiling_.ExpandRectToTileBounds(
- invalid_rect_outside_interest_rect_tiles));
+ invalidation_expanded_to_full_tiles.Union(
+ invalid_rect_outside_interest_rect_tiles);
// Split this inflated invalidation across tile boundaries and apply it
// to all tiles that it touches.
« no previous file with comments | « cc/resources/picture_pile.h ('k') | cc/resources/picture_pile_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698