diff options
author | Chris Craik <ccraik@google.com> | 2011-09-13 11:46:17 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2011-09-13 14:21:10 -0700 |
commit | 6fa81b6762dfc7fdd6d9f177d0c326e7bef3537b (patch) | |
tree | 9546b0b93b4316302de1fb9d5105f445d614c201 /Source/WebCore/platform | |
parent | 808dc42f1e6a574778bc9e8bd41beb7bd9aef06f (diff) | |
download | external_webkit-6fa81b6762dfc7fdd6d9f177d0c326e7bef3537b.zip external_webkit-6fa81b6762dfc7fdd6d9f177d0c326e7bef3537b.tar.gz external_webkit-6fa81b6762dfc7fdd6d9f177d0c326e7bef3537b.tar.bz2 |
Allocate textures based purely on viewport size
bug:5211417
Allocate textures based upon viewport size, instead of visible nr of tiles. This
will help prevent rare OOM issues triggering from a certain position in the
page.
Change-Id: Ib43fef0e0b9b8e4e26df448d67bb159a105e300c
Diffstat (limited to 'Source/WebCore/platform')
-rw-r--r-- | Source/WebCore/platform/graphics/android/GLWebViewState.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp index d85d8b7..5764a6b 100644 --- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp +++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp @@ -393,8 +393,11 @@ void GLWebViewState::setViewport(SkRect& viewport, float scale) static_cast<int>(ceilf(viewport.fRight * invTileContentWidth)), static_cast<int>(ceilf(viewport.fBottom * invTileContentHeight))); - int maxTextureCount = (m_viewportTileBounds.width() + TILE_PREFETCH_DISTANCE * 2) * - (m_viewportTileBounds.height() + TILE_PREFETCH_DISTANCE * 2) * 2; + // allocate max possible number of tiles visible with this viewport + int viewMaxTileX = static_cast<int>(ceilf((viewport.width()-1) * invTileContentWidth)) + 1; + int viewMaxTileY = static_cast<int>(ceilf((viewport.height()-1) * invTileContentHeight)) + 1; + int maxTextureCount = (viewMaxTileX + TILE_PREFETCH_DISTANCE * 2) * + (viewMaxTileY + TILE_PREFETCH_DISTANCE * 2) * 2; TilesManager::instance()->setMaxTextureCount(maxTextureCount); m_tiledPageA->updateBaseTileSize(); m_tiledPageB->updateBaseTileSize(); |