OSDN Git Service

Fix invalidation rect sizes
authorBen Murdoch <benm@google.com>
Thu, 15 Sep 2011 11:01:40 +0000 (12:01 +0100)
committerBen Murdoch <benm@google.com>
Fri, 16 Sep 2011 14:12:08 +0000 (15:12 +0100)
When splitting the invalidation rect over the tiles that it
invalidates, we need to use the tile's offset to calculate the
top/left co-ordinate in the case that the inval rect only covers
part of the tile.

(See change Ie3b4be68 for the regression)

Bug: 4965594
Change-Id: I6a18f1d3d223f5389b0f4f35fab9e579f499e9da

Source/WebKit/android/jni/PictureSet.cpp

index e6a9ed5..f61e0f1 100644 (file)
@@ -356,23 +356,10 @@ void PictureSet::splitAdd(const SkIRect& rect)
             SkIRect newRect;
             int deltaX = i * maxSize;
             int deltaY = j * maxSize;
-            int left, top, right, bottom;
-            if (i == firstTileX)
-                left = rect.fLeft;
-            else
-                left = 0;
-            if (j == firstTileY)
-                top = rect.fTop;
-            else
-                top = 0;
-            if (i == lastTileX)
-                right = rect.fRight % maxSize;
-            else
-                right = maxSize;
-            if (j == lastTileY)
-                bottom = rect.fBottom % maxSize;
-            else
-                bottom = maxSize;
+            int left = (i == firstTileX) ? rect.fLeft - deltaX : 0;
+            int top = (j == firstTileY) ? rect.fTop - deltaY : 0;
+            int right = (i == lastTileX) ? rect.fRight % maxSize : maxSize;
+            int bottom = (j == lastTileY) ? rect.fBottom % maxSize : maxSize;
 
             newRect.set(left, top, right, bottom);
             addToBucket(bucket, deltaX, deltaY, newRect);