diff options
author | Chris Craik <ccraik@google.com> | 2011-11-30 10:50:56 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-11-30 10:50:56 -0800 |
commit | b8b3807754d75135b83302cc511e68d556d4a523 (patch) | |
tree | be0999b8dd0553bc9407ce357b6668580623b48b | |
parent | 5b59024ec3e22bafe987cabff40f9a091d748fad (diff) | |
parent | 32f189562f7180e69a4d92f57cd6d24d8ef21b65 (diff) | |
download | external_webkit-b8b3807754d75135b83302cc511e68d556d4a523.zip external_webkit-b8b3807754d75135b83302cc511e68d556d4a523.tar.gz external_webkit-b8b3807754d75135b83302cc511e68d556d4a523.tar.bz2 |
am 32f18956: Merge "Don\'t prepare offscreen tiles" into ics-mr1
* commit '32f189562f7180e69a4d92f57cd6d24d8ef21b65':
Don't prepare offscreen tiles
-rw-r--r-- | Source/WebCore/platform/graphics/android/TiledPage.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/Source/WebCore/platform/graphics/android/TiledPage.cpp b/Source/WebCore/platform/graphics/android/TiledPage.cpp index e33d39a..2b3c2ee 100644 --- a/Source/WebCore/platform/graphics/android/TiledPage.cpp +++ b/Source/WebCore/platform/graphics/android/TiledPage.cpp @@ -242,9 +242,6 @@ void TiledPage::prepare(bool goingDown, bool goingLeft, const SkIRect& tileBound int nbTilesWidth = tileBounds.width(); int nbTilesHeight = tileBounds.height(); - int lastTileX = tileBounds.fRight - 1; - int lastTileY = tileBounds.fBottom - 1; - // Expand number of tiles to allow tiles outside of viewport to be prepared for // smoother scrolling. int nTilesToPrepare = nbTilesWidth * nbTilesHeight; @@ -256,21 +253,27 @@ void TiledPage::prepare(bool goingDown, bool goingLeft, const SkIRect& tileBound int expandY = m_glWebViewState->expandedTileBoundsY(); firstTileX -= expandX; - lastTileX += expandX; nbTilesWidth += expandX * 2; firstTileY -= expandY; - lastTileY += expandY; nbTilesHeight += expandY * 2; } // crop the prepared region to the contents of the base layer float maxWidthTiles = m_glWebViewState->baseContentWidth() * m_scale / TilesManager::tileWidth(); float maxHeightTiles = m_glWebViewState->baseContentHeight() * m_scale / TilesManager::tileHeight(); - firstTileX = std::max(0, firstTileX); - firstTileY = std::max(0, firstTileY); - lastTileX = std::min(lastTileX, static_cast<int>(ceilf(maxWidthTiles)) - 1); - lastTileY = std::min(lastTileY, static_cast<int>(ceilf(maxHeightTiles)) - 1); + + // adjust perimeter to not go outside base content bounds + if (firstTileX < 0) { + nbTilesWidth += firstTileX; + firstTileX = 0; + } + if (firstTileY < 0) { + nbTilesHeight += firstTileY; + firstTileY = 0; + } + nbTilesWidth = std::min(nbTilesWidth, static_cast<int>(ceilf(maxWidthTiles)) - firstTileX); + nbTilesHeight = std::min(nbTilesHeight, static_cast<int>(ceilf(maxHeightTiles)) - firstTileY); // check against corrupted scale values giving bad height/width (use float to avoid overflow) float numTiles = static_cast<float>(nbTilesHeight) * static_cast<float>(nbTilesWidth); |