Chromium Code Reviews| Index: cc/layers/tiled_layer.cc |
| diff --git a/cc/layers/tiled_layer.cc b/cc/layers/tiled_layer.cc |
| index a65067203783563902edbc06ee677aabbad7f258..8bb0b8a4416ee1696babdb0218e2c99d798f6eae 100644 |
| --- a/cc/layers/tiled_layer.cc |
| +++ b/cc/layers/tiled_layer.cc |
| @@ -334,8 +334,10 @@ bool TiledLayer::UpdateTiles(int left, |
| return false; |
| } |
| - gfx::Rect paint_rect = |
| - MarkTilesForUpdate(left, top, right, bottom, ignore_occlusions); |
| + gfx::Rect update_rect; |
| + gfx::Rect paint_rect; |
| + MarkTilesForUpdate( |
| + &update_rect, &paint_rect, left, top, right, bottom, ignore_occlusions); |
| if (occlusion) |
| occlusion->overdraw_metrics()->DidPaint(paint_rect); |
| @@ -345,7 +347,7 @@ bool TiledLayer::UpdateTiles(int left, |
| *updated = true; |
| UpdateTileTextures( |
| - paint_rect, left, top, right, bottom, queue, occlusion); |
| + update_rect, paint_rect, left, top, right, bottom, queue, occlusion); |
| return true; |
| } |
| @@ -422,12 +424,13 @@ bool TiledLayer::HaveTexturesForTiles(int left, |
| return true; |
| } |
| -gfx::Rect TiledLayer::MarkTilesForUpdate(int left, |
| - int top, |
| - int right, |
| - int bottom, |
| - bool ignore_occlusions) { |
| - gfx::Rect paint_rect; |
| +void TiledLayer::MarkTilesForUpdate(gfx::Rect* update_rect, |
| + gfx::Rect* paint_rect, |
| + int left, |
| + int top, |
| + int right, |
| + int bottom, |
| + bool ignore_occlusions) { |
| for (int j = top; j <= bottom; ++j) { |
| for (int i = left; i <= right; ++i) { |
| UpdatableTile* tile = TileAt(i, j); |
| @@ -437,6 +440,10 @@ gfx::Rect TiledLayer::MarkTilesForUpdate(int left, |
| continue; |
| if (tile->occluded && !ignore_occlusions) |
| continue; |
| + |
| + // Prepare update rect from original dirty rects |
|
danakj
2013/11/27 18:09:09
period at end of sentence.
|
| + update_rect->Union(tile->dirty_rect); |
| + |
| // TODO(reveman): Decide if partial update should be allowed based on cost |
| // of update. https://bugs.webkit.org/show_bug.cgi?id=77376 |
| if (tile->is_dirty() && |
| @@ -455,14 +462,14 @@ gfx::Rect TiledLayer::MarkTilesForUpdate(int left, |
| } |
| } |
| - paint_rect.Union(tile->dirty_rect); |
| + paint_rect->Union(tile->dirty_rect); |
| tile->MarkForUpdate(); |
| } |
| } |
| - return paint_rect; |
| } |
| -void TiledLayer::UpdateTileTextures(gfx::Rect paint_rect, |
| +void TiledLayer::UpdateTileTextures(gfx::Rect update_rect, |
| + gfx::Rect paint_rect, |
| int left, |
| int top, |
| int right, |
| @@ -477,13 +484,13 @@ void TiledLayer::UpdateTileTextures(gfx::Rect paint_rect, |
| float height_scale = |
| paint_properties().bounds.height() / |
| static_cast<float>(content_bounds().height()); |
| - update_rect_ = gfx::ScaleRect(paint_rect, width_scale, height_scale); |
| + update_rect_ = gfx::ScaleRect(update_rect, width_scale, height_scale); |
| // Calling PrepareToUpdate() calls into WebKit to paint, which may have the |
| // side effect of disabling compositing, which causes our reference to the |
| // texture updater to be deleted. However, we can't free the memory backing |
| - // the SkCanvas until the paint finishes, so we grab a local reference here to |
| - // hold the updater alive until the paint completes. |
| + // the SkCanvas until the paint finishes, so we grab a local reference here |
|
danakj
2013/11/27 18:09:09
this change looks unneeded?
|
| + // to hold the updater alive until the paint completes. |
| scoped_refptr<LayerUpdater> protector(Updater()); |
| gfx::Rect painted_opaque_rect; |
| Updater()->PrepareToUpdate(paint_rect, |