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..997a8a9d98abd1a83483e166b19491a712ded1e9 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,15 @@ bool PicturePile::Update(ContentLayerClient* painter, |
| recorded_viewport_ = interest_rect; |
| recorded_viewport_.Intersect(tiling_rect()); |
| + Region invalidation_expanded_to_recording_tiles; |
| + |
| 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 +189,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), |
|
enne (OOO)
2014/06/13 22:26:42
I think invalidation_expanded_to_recording_tiles.U
enne (OOO)
2014/06/13 22:34:13
Actually, more importantly, you should only inflat
|
| + tiling_.TileBoundsWithBorder(right_tile, bottom_tile)); |
| + invalidation_expanded_to_recording_tiles.Union(invalid_rect_filling_tiles); |
| } |
| + // Return the expanded invalidation. |
| + invalidation_expanded_to_recording_tiles.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; |