Chromium Code Reviews| Index: cc/resources/picture_pile.cc |
| diff --git a/cc/resources/picture_pile.cc b/cc/resources/picture_pile.cc |
| index 27c58a1ff44dc109db0e233c259c2612a5e9458d..a59d3cb34611ebb0142dfdaa617f47d0e6d4150a 100644 |
| --- a/cc/resources/picture_pile.cc |
| +++ b/cc/resources/picture_pile.cc |
| @@ -146,15 +146,16 @@ PicturePile::PicturePile() : is_suitable_for_gpu_rasterization_(true) {} |
| PicturePile::~PicturePile() { |
| } |
| -bool PicturePile::Update(ContentLayerClient* painter, |
| - SkColor background_color, |
| - bool contents_opaque, |
| - bool contents_fill_bounds_completely, |
| - const Region& invalidation, |
| - const gfx::Rect& visible_layer_rect, |
| - int frame_number, |
| - Picture::RecordingMode recording_mode, |
| - RenderingStatsInstrumentation* stats_instrumentation) { |
| +bool PicturePile::UpdateAndExpandInvalidation( |
| + ContentLayerClient* painter, |
| + Region* invalidation, |
| + SkColor background_color, |
| + bool contents_opaque, |
| + bool contents_fill_bounds_completely, |
| + const gfx::Rect& visible_layer_rect, |
| + int frame_number, |
| + Picture::RecordingMode recording_mode, |
| + RenderingStatsInstrumentation* stats_instrumentation) { |
| background_color_ = background_color; |
| contents_opaque_ = contents_opaque; |
| contents_fill_bounds_completely_ = contents_fill_bounds_completely; |
| @@ -168,13 +169,18 @@ bool PicturePile::Update(ContentLayerClient* painter, |
| recorded_viewport_ = interest_rect; |
| recorded_viewport_.Intersect(tiling_rect()); |
| + // Anything outside the interest rect may no longer be valid, we don't care to |
| + // know so consider it invalid. |
| + Region invalidation_across_frames = tiling_.tiling_rect(); |
| + invalidation_across_frames.Subtract(interest_rect); |
|
enne (OOO)
2014/06/13 21:16:44
The one bad part about this is that if you have a
danakj
2014/06/13 21:19:18
our goal is to invalidate all tiles on the pending
enne (OOO)
2014/06/13 21:23:20
The only recordings that are dropped are ones that
|
| + |
| bool invalidated = false; |
| - for (Region::Iterator i(invalidation); i.has_rect(); i.next()) { |
| - gfx::Rect invalidation = i.rect(); |
| + for (Region::Iterator i(*invalidation); i.has_rect(); i.next()) { |
| + gfx::Rect invalid_rect = i.rect(); |
| // Split this inflated invalidation across tile boundaries and apply it |
| // to all tiles that it touches. |
| bool include_borders = true; |
| - for (TilingData::Iterator iter(&tiling_, invalidation, include_borders); |
| + for (TilingData::Iterator iter(&tiling_, invalid_rect, include_borders); |
| iter; |
| ++iter) { |
| const PictureMapKey& key = iter.index(); |
| @@ -186,8 +192,22 @@ bool PicturePile::Update(ContentLayerClient* painter, |
| // Inform the grid cell that it has been invalidated in this frame. |
| invalidated = picture_it->second.Invalidate(frame_number) || invalidated; |
| } |
| + |
| + int left_tile = tiling_.FirstBorderTileXIndexFromSrcCoord(invalid_rect.x()); |
| + int top_tile = tiling_.FirstBorderTileYIndexFromSrcCoord(invalid_rect.y()); |
| + int right_tile = |
| + tiling_.LastBorderTileXIndexFromSrcCoord(invalid_rect.right() - 1); |
| + int bottom_tile = |
| + tiling_.LastBorderTileYIndexFromSrcCoord(invalid_rect.bottom() - 1); |
| + gfx::Rect invalid_rect_filling_tiles = |
| + gfx::UnionRects(tiling_.TileBoundsWithBorder(left_tile, top_tile), |
| + tiling_.TileBoundsWithBorder(right_tile, bottom_tile)); |
| + invalidation_across_frames.Union(invalid_rect_filling_tiles); |
| } |
| + // Return the expanded invalidation from this frame and previous frames. |
| + invalidation_across_frames.Swap(invalidation); |
| + |
| // Make a list of all invalid tiles; we will attempt to |
| // cluster these into multiple invalidation regions. |
| std::vector<gfx::Rect> invalid_tiles; |