Index: cc/layers/tiled_layer.cc |
diff --git a/cc/layers/tiled_layer.cc b/cc/layers/tiled_layer.cc |
index a65067203783563902edbc06ee677aabbad7f258..000621c639693a4aa0b800de89458df42c8cab78 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 |
+ 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,20 +484,23 @@ 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); |
- |
- // 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. |
- scoped_refptr<LayerUpdater> protector(Updater()); |
+ update_rect_ = gfx::ScaleRect(update_rect, width_scale, height_scale); |
+ |
gfx::Rect painted_opaque_rect; |
- Updater()->PrepareToUpdate(paint_rect, |
- tiler_->tile_size(), |
- 1.f / width_scale, |
- 1.f / height_scale, |
- &painted_opaque_rect); |
+ if (!update_rect.IsEmpty()) { |
enne (OOO)
2013/11/25 20:59:48
I'm not sure this can ever happen. I'd prefer a D
prashant.n
2013/11/26 04:56:06
Yes, true, this will never happen. I'll remove thi
|
+ // 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. |
+ scoped_refptr<LayerUpdater> protector(Updater()); |
+ Updater()->PrepareToUpdate(update_rect, |
enne (OOO)
2013/11/25 20:59:48
Re: point #2, I think this is wrong. You need the
prashant.n
2013/11/26 04:56:06
In TiledLayer::TileOnlyNeedsPartialUpdate(), we ch
danakj
2013/11/26 16:08:39
I agree, it should only be the update_rect_ that c
|
+ paint_rect, |
+ tiler_->tile_size(), |
+ 1.f / width_scale, |
+ 1.f / height_scale, |
+ &painted_opaque_rect); |
+ } |
for (int j = top; j <= bottom; ++j) { |
for (int i = left; i <= right; ++i) { |