[WK2] Recalculate coverRect by intersecting with contentsRect.
authorJungJik Lee <jungjik.lee@samsung.com>
Thu, 5 Sep 2013 10:55:28 +0000 (19:55 +0900)
committerJungJik Lee <jungjik.lee@samsung.com>
Fri, 6 Sep 2013 07:32:49 +0000 (16:32 +0900)
[Title] [WK2] Recalculate coverRect by intersecting with contentsRect.
[Issue#] WGL-480 WGL-355 WGL-437 WGL-438
[Problem] currently TBS is drawing tiles far away from viewport.
[Cause] TBS allocates many tiles for outside tiles and it causes a runout of pixmap memory.
[Solution] intersection with contentsRect.

Change-Id: I5cb60887f233909cc37e0039ac074e71411648e4

Source/WebCore/platform/graphics/TiledBackingStore.cpp

index 12e5440..2471bed 100755 (executable)
@@ -443,21 +443,18 @@ void TiledBackingStore::adjustForContentsRect(IntRect& rect) const
     IntRect bounds = m_rect;
     IntSize candidateSize = rect.size();
 
-    // If candidateSize is bigger than bounds (i.e. TBS is used as a backing store of GraphicsLayer), we skip the below adjusting logic which expects bounds to cover the given rect.
-    if (candidateSize.width() > bounds.width() && candidateSize.height() > bounds.height()) {
-        rect.intersect(bounds);
+    rect.intersect(bounds);
+
+    if (rect.size() == candidateSize)
         return;
-    }
 
-    // We will try to keep the cover and keep rect the same size at all time, which
-    // might not be the case when at the content edges.
+    if (rect.isEmpty())
+        return;
 
     // We start by moving when at the edges.
     rect.move(std::max(0, bounds.x() - rect.x()), std::max(0, bounds.y() - rect.y()));
     rect.move(std::min(0, bounds.maxX() - rect.maxX()), std::min(0, bounds.maxY() - rect.maxY()));
 
-    rect.intersect(bounds);
-
 #if !ENABLE(TIZEN_WEBKIT2_TILED_AC_DONT_ADJUST_COVER_RECT)
     if (rect.size() == candidateSize)
         return;