⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 106870 in webkit


Ignore:
Timestamp:
Feb 6, 2012, 4:25:16 PM (15 years ago)
Author:
jamesr@google.com
Message:

[chromium] Drop tiles completely outside of layer bounds when resizing to a smaller size
https://bugs.webkit.org/show_bug.cgi?id=77910

Reviewed by Kenneth Russell.

Source/WebCore:

When resizing a tiled layer to a smaller size, drop all tiles that lie completely outside the new layer bounds.
This avoids attempting to access out-of-bounds tiles when iterating over all tiles in the tiler, which triggers
ASSERT()s, as well as saves some memory.

New unit test added to TiledLayerChromiumTest.

  • platform/graphics/chromium/TiledLayerChromium.cpp:

(WebCore::TiledLayerChromium::invalidateRect):

  • platform/graphics/chromium/cc/CCLayerTilingData.cpp:

(WebCore::CCLayerTilingData::setBounds):

Source/WebKit/chromium:

Adds test for resizing a layer to cover fewer tiles. Test hits ASSERT()s without any code changes.

  • tests/TiledLayerChromiumTest.cpp:

(::TEST):

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r106864 r106870  
     12012-02-06  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] Drop tiles completely outside of layer bounds when resizing to a smaller size
     4        https://bugs.webkit.org/show_bug.cgi?id=77910
     5
     6        Reviewed by Kenneth Russell.
     7
     8        When resizing a tiled layer to a smaller size, drop all tiles that lie completely outside the new layer bounds.
     9        This avoids attempting to access out-of-bounds tiles when iterating over all tiles in the tiler, which triggers
     10        ASSERT()s, as well as saves some memory.
     11
     12        New unit test added to TiledLayerChromiumTest.
     13
     14        * platform/graphics/chromium/TiledLayerChromium.cpp:
     15        (WebCore::TiledLayerChromium::invalidateRect):
     16        * platform/graphics/chromium/cc/CCLayerTilingData.cpp:
     17        (WebCore::CCLayerTilingData::setBounds):
     18
    1192012-02-06  Chris Rogers  <crogers@google.com>
    220
  • trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp

    r106732 r106870  
    313313void TiledLayerChromium::invalidateRect(const IntRect& layerRect)
    314314{
     315    updateBounds();
    315316    if (m_tiler->isEmpty() || layerRect.isEmpty() || m_skipsDraw)
    316317        return;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.cpp

    r106160 r106870  
    118118{
    119119    m_tilingData.setTotalSize(size.width(), size.height());
     120
     121    // Any tiles completely outside our new bounds are invalid and should be dropped.
     122    int left, top, right, bottom;
     123    layerRectToTileIndices(IntRect(IntPoint(), size), left, top, right, bottom);
     124    Vector<TileMapKey> invalidTileKeys;
     125    for (TileMap::const_iterator it = m_tiles.begin(); it != m_tiles.end(); ++it) {
     126        if (it->first.first > right || it->first.second > bottom)
     127            invalidTileKeys.append(it->first);
     128    }
     129    for (size_t i = 0; i < invalidTileKeys.size(); ++i)
     130        m_tiles.remove(invalidTileKeys[i]);
    120131}
    121132
  • trunk/Source/WebKit/chromium/ChangeLog

    r106867 r106870  
     12012-02-06  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] Drop tiles completely outside of layer bounds when resizing to a smaller size
     4        https://bugs.webkit.org/show_bug.cgi?id=77910
     5
     6        Reviewed by Kenneth Russell.
     7
     8        Adds test for resizing a layer to cover fewer tiles. Test hits ASSERT()s without any code changes.
     9
     10        * tests/TiledLayerChromiumTest.cpp:
     11        (::TEST):
     12
    1132012-02-06  Ryosuke Niwa  <rniwa@webkit.org>
    214
  • trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp

    r106700 r106870  
    566566}
    567567
     568TEST(TiledLayerChromiumTest, resizeToSmaller)
     569{
     570    OwnPtr<TextureManager> textureManager = TextureManager::create(60*1024*1024, 60*1024*1024, 1024);
     571    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     572
     573    layer->setBounds(IntSize(700, 700));
     574    layer->invalidateRect(IntRect(0, 0, 700, 700));
     575    layer->prepareToUpdate(IntRect(0, 0, 700, 700));
     576
     577    layer->setBounds(IntSize(200, 200));
     578    layer->invalidateRect(IntRect(0, 0, 200, 200));
     579}
     580
    568581} // namespace
Note: See TracChangeset for help on using the changeset viewer.