[Cherry-pick] [Texmap] Update a dirty region which is not covered with keepRect.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2013 14:58:37 +0000 (14:58 +0000)
committerJungJik Lee <jungjik.lee@samsung.com>
Thu, 11 Apr 2013 09:26:31 +0000 (18:26 +0900)
[Title] [Cherry-pick] [Texmap] Update a dirty region which is not covered with keepRect.
[Issue] NA
[Problem] Possible to get the performance regression by the previous patch.
[Cause] Iterating more tiles to apply the dirty region then before.
[Solution] Refactoring code of "[WK2] Recover a loss of dirty region" patch.

[Cherry-pick] [Texmap] Update a dirty region which is not covered with keepRect.

https://bugs.webkit.org/show_bug.cgi?id=113752

Patch by JungJik Lee <jungjik.lee@samsung.com> on 2013-04-10
Reviewed by Jocelyn Turcotte.

There can be a dirty region which is not covered with keepRect.
However the dirty could be inside the tile area. In this case,
currently we ignore the dirty by intersecting with keepRect
and the dirty region will not be invalidated until the tile is
recreated. We must expand the keep rect to its intersecting tiles
to make sure that the dirty region is applied to existing tiles.

No tests needed, change is unobservable.

* platform/graphics/TiledBackingStore.cpp:
(WebCore::TiledBackingStore::invalidate):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148094 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/platform/graphics/TiledBackingStore.cpp

index aab68f7..3570358 100755 (executable)
@@ -106,9 +106,13 @@ void TiledBackingStore::coverWithTilesIfNeeded(const FloatPoint& trajectoryVecto
 void TiledBackingStore::invalidate(const IntRect& contentsDirtyRect)
 {
     IntRect dirtyRect(mapFromContents(contentsDirtyRect));
+    IntRect keepRectFitToTileSize = tileRectForCoordinate(tileCoordinateForPoint(m_keepRect.location()));
+    keepRectFitToTileSize.unite(tileRectForCoordinate(tileCoordinateForPoint(innerBottomRight(m_keepRect))));
 
-    Tile::Coordinate topLeft = tileCoordinateForPoint(dirtyRect.location());
-    Tile::Coordinate bottomRight = tileCoordinateForPoint(innerBottomRight(dirtyRect));
+    // Only iterate on the part of the rect that we know we might have tiles.
+    IntRect coveredDirtyRect = intersection(dirtyRect, keepRectFitToTileSize);
+    Tile::Coordinate topLeft = tileCoordinateForPoint(coveredDirtyRect.location());
+    Tile::Coordinate bottomRight = tileCoordinateForPoint(innerBottomRight(coveredDirtyRect));
 
     for (int yCoordinate = topLeft.y(); yCoordinate <= bottomRight.y(); ++yCoordinate) {
         for (int xCoordinate = topLeft.x(); xCoordinate <= bottomRight.x(); ++xCoordinate) {