From 6fa81b6762dfc7fdd6d9f177d0c326e7bef3537b Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Tue, 13 Sep 2011 11:46:17 -0700 Subject: 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 --- Source/WebCore/platform/graphics/android/GLWebViewState.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Source/WebCore/platform/graphics') 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(ceilf(viewport.fRight * invTileContentWidth)), static_cast(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(ceilf((viewport.width()-1) * invTileContentWidth)) + 1; + int viewMaxTileY = static_cast(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(); -- cgit v1.1