From 87fe8475ab1b747912f0fb322c1e6f1f159a5d60 Mon Sep 17 00:00:00 2001 From: "prashant.n@samsung.com" Date: Thu, 5 Dec 2013 07:22:47 +0000 Subject: Dirty rects always contain full tiles with delegated rendering. Fix: Compute update_rect separately from original dirty rects and pass them to update_rect_ as well as updating the contents. BUG=316469 Review URL: https://codereview.chromium.org/85143002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238911 0039d316-1c4b-4281-b951-d872f2087c98 --- cc/layers/content_layer.h | 4 +++- cc/layers/tiled_layer.cc | 33 ++++++++++++++++++++------------- cc/layers/tiled_layer.h | 15 +++++++++------ 3 files changed, 32 insertions(+), 20 deletions(-) (limited to 'cc/layers') diff --git a/cc/layers/content_layer.h b/cc/layers/content_layer.h index e7782ce..45de86c 100644 --- a/cc/layers/content_layer.h +++ b/cc/layers/content_layer.h @@ -60,9 +60,11 @@ class CC_EXPORT ContentLayer : public TiledLayer { explicit ContentLayer(ContentLayerClient* client); virtual ~ContentLayer(); - private: // TiledLayer implementation. virtual LayerUpdater* Updater() const OVERRIDE; + + private: + // TiledLayer implementation. virtual void CreateUpdaterIfNeeded() OVERRIDE; void UpdateCanUseLCDText(); diff --git a/cc/layers/tiled_layer.cc b/cc/layers/tiled_layer.cc index a650672..24baef5 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,7 +484,7 @@ void TiledLayer::UpdateTileTextures(gfx::Rect paint_rect, float height_scale = paint_properties().bounds.height() / static_cast(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 diff --git a/cc/layers/tiled_layer.h b/cc/layers/tiled_layer.h index a7bd9f7b..8206360 100644 --- a/cc/layers/tiled_layer.h +++ b/cc/layers/tiled_layer.h @@ -103,12 +103,15 @@ class CC_EXPORT TiledLayer : public ContentsScalingLayer { int right, int bottom, bool ignore_occlusions); - gfx::Rect MarkTilesForUpdate(int left, - int top, - int right, - int bottom, - bool ignore_occlusions); - void UpdateTileTextures(gfx::Rect paint_rect, + void MarkTilesForUpdate(gfx::Rect* update_rect, + gfx::Rect* paint_rect, + int left, + int top, + int right, + int bottom, + bool ignore_occlusions); + void UpdateTileTextures(gfx::Rect update_rect, + gfx::Rect paint_rect, int left, int top, int right, -- cgit v1.1