Title: [106411] trunk/Source/WebCore
Revision
106411
Author
[email protected]
Date
2012-01-31 15:58:04 -0800 (Tue, 31 Jan 2012)

Log Message

TileCache::setNeedsDisplayInRect cleanup
https://bugs.webkit.org/show_bug.cgi?id=77486

Reviewed by Andreas Kling.

* platform/graphics/ca/mac/TileCache.h:
* platform/graphics/ca/mac/TileCache.mm:
(WebCore::TileCache::setNeedsDisplayInRect):
TileCache::tileLayerAtIndex can in the future return nil, so cope with that. Also, replace
nested if statements with continue statements.

(WebCore::TileCache::getTileIndexRangeForRect):
Rename this to better indicate that it returns a range of indices.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (106410 => 106411)


--- trunk/Source/WebCore/ChangeLog	2012-01-31 23:55:39 UTC (rev 106410)
+++ trunk/Source/WebCore/ChangeLog	2012-01-31 23:58:04 UTC (rev 106411)
@@ -1,3 +1,19 @@
+2012-01-31  Anders Carlsson  <[email protected]>
+
+        TileCache::setNeedsDisplayInRect cleanup
+        https://bugs.webkit.org/show_bug.cgi?id=77486
+
+        Reviewed by Andreas Kling.
+
+        * platform/graphics/ca/mac/TileCache.h:
+        * platform/graphics/ca/mac/TileCache.mm:
+        (WebCore::TileCache::setNeedsDisplayInRect):
+        TileCache::tileLayerAtIndex can in the future return nil, so cope with that. Also, replace
+        nested if statements with continue statements.
+
+        (WebCore::TileCache::getTileIndexRangeForRect):
+        Rename this to better indicate that it returns a range of indices.
+
 2012-01-31  Dana Jansens  <[email protected]>
 
         Add contains() test to Region

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h (106410 => 106411)


--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h	2012-01-31 23:55:39 UTC (rev 106410)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h	2012-01-31 23:58:04 UTC (rev 106411)
@@ -75,7 +75,7 @@
     FloatRect visibleRect() const;
 
     IntRect bounds() const;
-    void getTileRangeForRect(const IntRect&, IntPoint& topLeft, IntPoint& bottomRight);
+    void getTileIndexRangeForRect(const IntRect&, TileIndex& topLeft, TileIndex& bottomRight);
 
     IntSize numTilesForGridSize(const IntSize&) const;
     void resizeTileGrid(const IntSize& numTiles);

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm (106410 => 106411)


--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm	2012-01-31 23:55:39 UTC (rev 106410)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm	2012-01-31 23:58:04 UTC (rev 106411)
@@ -81,24 +81,26 @@
         return;
 
     // Find the tiles that need to be invalidated.
-    IntPoint topLeft;
-    IntPoint bottomRight;
-    getTileRangeForRect(rect, topLeft, bottomRight);
+    TileIndex topLeft;
+    TileIndex bottomRight;
+    getTileIndexRangeForRect(rect, topLeft, bottomRight);
 
     for (int y = topLeft.y(); y <= bottomRight.y(); ++y) {
         for (int x = topLeft.x(); x <= bottomRight.x(); ++x) {
-            WebTileLayer* tileLayer = tileLayerAtIndex(IntPoint(x, y));
+            WebTileLayer* tileLayer = tileLayerAtIndex(TileIndex(x, y));
+            if (!tileLayer)
+                continue;
 
             CGRect tileRect = [m_tileCacheLayer convertRect:rect toLayer:tileLayer];
+            if (CGRectIsEmpty(tileRect))
+                continue;
 
-            if (!CGRectIsEmpty(tileRect)) {
-                [tileLayer setNeedsDisplayInRect:tileRect];
+            [tileLayer setNeedsDisplayInRect:tileRect];
 
-                if (shouldShowRepaintCounters()) {
-                    CGRect bounds = [tileLayer bounds];
-                    CGRect indicatorRect = CGRectMake(bounds.origin.x, bounds.origin.y, 52, 27);
-                    [tileLayer setNeedsDisplayInRect:indicatorRect];
-                }
+            if (shouldShowRepaintCounters()) {
+                CGRect bounds = [tileLayer bounds];
+                CGRect indicatorRect = CGRectMake(bounds.origin.x, bounds.origin.y, 52, 27);
+                [tileLayer setNeedsDisplayInRect:indicatorRect];
             }
         }
     }
@@ -217,7 +219,7 @@
     return IntRect(IntPoint(), IntSize([m_tileCacheLayer bounds].size));
 }
 
-void TileCache::getTileRangeForRect(const IntRect& rect, IntPoint& topLeft, IntPoint& bottomRight)
+void TileCache::getTileIndexRangeForRect(const IntRect& rect, TileIndex& topLeft, TileIndex& bottomRight)
 {
     topLeft.setX(max(rect.x() / m_tileSize.width(), 0));
     topLeft.setY(max(rect.y() / m_tileSize.height(), 0));
@@ -246,10 +248,10 @@
 
             if (x < m_numTilesInGrid.width() && y < m_numTilesInGrid.height()) {
                 // We can reuse the tile layer at this index.
-                tileLayer = tileLayerAtIndex(IntPoint(x, y));
+                tileLayer = tileLayerAtIndex(TileIndex(x, y));
             } else {
                 tileLayer = createTileLayer();
-                m_tiles.set(IntPoint(x, y), tileLayer.get());
+                m_tiles.set(TileIndex(x, y), tileLayer.get());
             }
 
             [tileLayer.get() setPosition:CGPointMake(x * m_tileSize.width(), y * m_tileSize.height())];
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to