Chromium Code Reviews| Index: cc/resources/picture_pile.cc |
| diff --git a/cc/resources/picture_pile.cc b/cc/resources/picture_pile.cc |
| index a45dd9e71b1fb1f5ff323805b3f0d094fe6e3f1c..85182e053c6a2ab6dc4d865c92703a1bc7ff99fe 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,34 @@ 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. |
| + tile_invalidation.Inset(-buffer_pixels(), -buffer_pixels()); |
| + tile_invalidation.Intersect(tile); |
| + |
| + // Make sure that the invalidation is at least large enough to cover a |
| + // single rastered pixel when scaled down by any scale no smaller than |
| + // the minimum contents scale. This means ensuring the resulting rect |
| + // is at least (2 * buffer_pixels() + 1) large in each dimension. |
| + // |
| + // Because we already inflated by buffer_pixels() in each direction, |
| + // and the |tile| is larger than our required minimum size, the |
| + // intersection will only drop at most buffer_pixels() from the |
| + // invalidation rect in each dimension. Inflating and intersecting once |
| + // more will give us the minimum size required. |
| + if (tile_invalidation.width() < buffer_pixels() * 2 + 1) |
|
enne (OOO)
2013/05/05 01:26:47
Sorry, but no?
It's not about total width. It's
danakj
2013/05/06 14:40:06
Hm, I am not sure if I agree, so let's make some p
|
| + tile_invalidation.Inset(-buffer_pixels(), 0); |
| + if (tile_invalidation.height() < buffer_pixels() * 2 + 1) |
| + tile_invalidation.Inset(0, -buffer_pixels()); |
| + 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); |
| + } |
| } |
| } |