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

Unified Diff: cc/resources/picture_pile.cc

Issue 14874004: cc: Inflate invalidation in each picture list (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for windows Created 7 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
Index: cc/resources/picture_pile.cc
diff --git a/cc/resources/picture_pile.cc b/cc/resources/picture_pile.cc
index a45dd9e71b1fb1f5ff323805b3f0d094fe6e3f1c..ce254617faa3fb04b18d0a9d93436e80a0cfcaa9 100644
--- a/cc/resources/picture_pile.cc
+++ b/cc/resources/picture_pile.cc
@@ -46,18 +46,10 @@ void PicturePile::Update(
-kPixelDistanceToRecord,
-kPixelDistanceToRecord);
for (Region::Iterator i(invalidation); i.has_rect(); i.next()) {
- // Inflate all recordings from invalidations with a margin so that when
- // scaled down to at least min_contents_scale, any final pixel touched by an
- // invalidation can be fully rasterized by this picture.
- gfx::Rect inflated_invalidation = i.rect();
- inflated_invalidation.Inset(
- -buffer_pixels(),
- -buffer_pixels(),
- -buffer_pixels(),
- -buffer_pixels());
+ gfx::Rect invalidation = i.rect();
// Split this inflated invalidation across tile boundaries and apply it
// to all tiles that it touches.
- for (TilingData::Iterator iter(&tiling_, inflated_invalidation);
+ for (TilingData::Iterator iter(&tiling_, invalidation);
iter; ++iter) {
gfx::Rect tile =
tiling_.TileBoundsWithBorder(iter.index_x(), iter.index_y());
@@ -68,8 +60,7 @@ void PicturePile::Update(
continue;
}
- gfx::Rect tile_invalidation =
- gfx::IntersectRects(inflated_invalidation, tile);
+ gfx::Rect tile_invalidation = gfx::IntersectRects(invalidation, tile);
if (tile_invalidation.IsEmpty())
continue;
PictureListMap::iterator find = picture_list_map_.find(iter.index());
@@ -77,8 +68,28 @@ void PicturePile::Update(
continue;
PictureList& pic_list = find->second;
// Leave empty pic_lists empty in case there are multiple invalidations.
- if (!pic_list.empty())
+ if (!pic_list.empty()) {
+ // Inflate all recordings from invalidations with a margin so that when
+ // scaled down to at least min_contents_scale, any final pixel touched
+ // by an invalidation can be fully rasterized by this picture.
+ for (int i = 0; i < 2; ++i) {
enne (OOO) 2013/05/03 07:00:57 This is not right. It's not just for scaling down
danakj 2013/05/03 17:49:20 Okay so let me see if I'm understanding correctly.
+ int width_inflate = 0;
+ int height_inflate = 0;
+ if (tile_invalidation.width() < buffer_pixels() * 2 + 1)
+ width_inflate = buffer_pixels();
+ if (tile_invalidation.height() < buffer_pixels() * 2 + 1)
+ height_inflate = buffer_pixels();
+ if (!width_inflate && !height_inflate)
+ break;
+ tile_invalidation.Inset(-width_inflate, -height_inflate);
+ tile_invalidation.Intersect(tile);
+ }
+
+ DCHECK_GE(tile_invalidation.width(), buffer_pixels() * 2 + 1);
+ DCHECK_GE(tile_invalidation.height(), buffer_pixels() * 2 + 1);
+
InvalidateRect(pic_list, tile_invalidation);
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698