summaryrefslogtreecommitdiffstats
path: root/Source/WebCore
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2011-11-29 17:22:40 -0800
committerChris Craik <ccraik@google.com>2011-11-29 17:47:07 -0800
commit858f4e6fcacb1d8e2244a927eec8bfee56b6d73b (patch)
tree0e3d1b3204ea37c9dae0626e57ac0f29974c3a9a /Source/WebCore
parent9c0e7d80ade0cc9bbe087838232cd0877fa01a98 (diff)
downloadexternal_webkit-858f4e6fcacb1d8e2244a927eec8bfee56b6d73b.zip
external_webkit-858f4e6fcacb1d8e2244a927eec8bfee56b6d73b.tar.gz
external_webkit-858f4e6fcacb1d8e2244a927eec8bfee56b6d73b.tar.bz2
Don't prepare offscreen tiles
bug:5675837 Corrected max tile bounds logic Removed unused local variables Change-Id: I3a47fa69b720c59c9468dfca03638e66e3ac78dc
Diffstat (limited to 'Source/WebCore')
-rw-r--r--Source/WebCore/platform/graphics/android/TiledPage.cpp21
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);