diff options
author | Chris Craik <ccraik@google.com> | 2011-11-30 17:01:07 -0800 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2011-11-30 17:01:07 -0800 |
commit | 974511289d54268f4333d440776f8fc44f22fcfe (patch) | |
tree | 242ec881903eb92b9adcaa2dcb4e9bf6cc6b3ffe /Source/WebCore/platform/graphics | |
parent | e1ea7f8384757f9b46805df75a0aa72c1fc041b7 (diff) | |
download | external_webkit-974511289d54268f4333d440776f8fc44f22fcfe.zip external_webkit-974511289d54268f4333d440776f8fc44f22fcfe.tar.gz external_webkit-974511289d54268f4333d440776f8fc44f22fcfe.tar.bz2 |
Fix offscreen tile optimization with small content
bug:5691644
Change-Id: Ida66f42c634099c4399bae0bbf4b5776913757b0
Diffstat (limited to 'Source/WebCore/platform/graphics')
-rw-r--r-- | Source/WebCore/platform/graphics/android/TiledPage.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Source/WebCore/platform/graphics/android/TiledPage.cpp b/Source/WebCore/platform/graphics/android/TiledPage.cpp index 2b3c2ee..8352cce 100644 --- a/Source/WebCore/platform/graphics/android/TiledPage.cpp +++ b/Source/WebCore/platform/graphics/android/TiledPage.cpp @@ -257,23 +257,23 @@ void TiledPage::prepare(bool goingDown, bool goingLeft, const SkIRect& tileBound firstTileY -= 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(); + // 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(); - // adjust perimeter to not go outside base content bounds - if (firstTileX < 0) { - nbTilesWidth += firstTileX; - firstTileX = 0; - } - if (firstTileY < 0) { - nbTilesHeight += firstTileY; - firstTileY = 0; + // 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); } - 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); |