Changeset 106411 in webkit


Ignore:
Timestamp:
Jan 31, 2012 3:58:04 PM (12 years ago)
Author:
andersca@apple.com
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.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r106408 r106411  
     12012-01-31  Anders Carlsson  <andersca@apple.com>
     2
     3        TileCache::setNeedsDisplayInRect cleanup
     4        https://bugs.webkit.org/show_bug.cgi?id=77486
     5
     6        Reviewed by Andreas Kling.
     7
     8        * platform/graphics/ca/mac/TileCache.h:
     9        * platform/graphics/ca/mac/TileCache.mm:
     10        (WebCore::TileCache::setNeedsDisplayInRect):
     11        TileCache::tileLayerAtIndex can in the future return nil, so cope with that. Also, replace
     12        nested if statements with continue statements.
     13
     14        (WebCore::TileCache::getTileIndexRangeForRect):
     15        Rename this to better indicate that it returns a range of indices.
     16
    1172012-01-31  Dana Jansens  <danakj@chromium.org>
    218
  • trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h

    r106397 r106411  
    7676
    7777    IntRect bounds() const;
    78     void getTileRangeForRect(const IntRect&, IntPoint& topLeft, IntPoint& bottomRight);
     78    void getTileIndexRangeForRect(const IntRect&, TileIndex& topLeft, TileIndex& bottomRight);
    7979
    8080    IntSize numTilesForGridSize(const IntSize&) const;
  • trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm

    r106397 r106411  
    8282
    8383    // Find the tiles that need to be invalidated.
    84     IntPoint topLeft;
    85     IntPoint bottomRight;
    86     getTileRangeForRect(rect, topLeft, bottomRight);
     84    TileIndex topLeft;
     85    TileIndex bottomRight;
     86    getTileIndexRangeForRect(rect, topLeft, bottomRight);
    8787
    8888    for (int y = topLeft.y(); y <= bottomRight.y(); ++y) {
    8989        for (int x = topLeft.x(); x <= bottomRight.x(); ++x) {
    90             WebTileLayer* tileLayer = tileLayerAtIndex(IntPoint(x, y));
     90            WebTileLayer* tileLayer = tileLayerAtIndex(TileIndex(x, y));
     91            if (!tileLayer)
     92                continue;
    9193
    9294            CGRect tileRect = [m_tileCacheLayer convertRect:rect toLayer:tileLayer];
    93 
    94             if (!CGRectIsEmpty(tileRect)) {
    95                 [tileLayer setNeedsDisplayInRect:tileRect];
    96 
    97                 if (shouldShowRepaintCounters()) {
    98                     CGRect bounds = [tileLayer bounds];
    99                     CGRect indicatorRect = CGRectMake(bounds.origin.x, bounds.origin.y, 52, 27);
    100                     [tileLayer setNeedsDisplayInRect:indicatorRect];
    101                 }
     95            if (CGRectIsEmpty(tileRect))
     96                continue;
     97
     98            [tileLayer setNeedsDisplayInRect:tileRect];
     99
     100            if (shouldShowRepaintCounters()) {
     101                CGRect bounds = [tileLayer bounds];
     102                CGRect indicatorRect = CGRectMake(bounds.origin.x, bounds.origin.y, 52, 27);
     103                [tileLayer setNeedsDisplayInRect:indicatorRect];
    102104            }
    103105        }
     
    218220}
    219221
    220 void TileCache::getTileRangeForRect(const IntRect& rect, IntPoint& topLeft, IntPoint& bottomRight)
     222void TileCache::getTileIndexRangeForRect(const IntRect& rect, TileIndex& topLeft, TileIndex& bottomRight)
    221223{
    222224    topLeft.setX(max(rect.x() / m_tileSize.width(), 0));
     
    247249            if (x < m_numTilesInGrid.width() && y < m_numTilesInGrid.height()) {
    248250                // We can reuse the tile layer at this index.
    249                 tileLayer = tileLayerAtIndex(IntPoint(x, y));
     251                tileLayer = tileLayerAtIndex(TileIndex(x, y));
    250252            } else {
    251253                tileLayer = createTileLayer();
    252                 m_tiles.set(IntPoint(x, y), tileLayer.get());
     254                m_tiles.set(TileIndex(x, y), tileLayer.get());
    253255            }
    254256
Note: See TracChangeset for help on using the changeset viewer.