summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2011-08-17 11:59:05 -0700
committerChris Craik <ccraik@google.com>2011-08-17 17:10:32 -0700
commite302ae4e13736d03118318e52aab6c4847285626 (patch)
tree74c8912e649ad492e982db542c2e0da9afe80924 /Source/WebCore/platform/graphics/android/GLWebViewState.cpp
parentbd7e9ea6769039d66b97b4286e096416b53bdc4a (diff)
downloadexternal_webkit-e302ae4e13736d03118318e52aab6c4847285626.zip
external_webkit-e302ae4e13736d03118318e52aab6c4847285626.tar.gz
external_webkit-e302ae4e13736d03118318e52aab6c4847285626.tar.bz2
tile prefetching now triggered automatically
bug:5178457 bug:5168261 Tiles are now prefetched at a distance of 2 from the view if the content is at least 1.2x the size of the view (in each dimension independantly) Change-Id: I1c251ffbbae709f8924133b9b22df39b4fa88b4c
Diffstat (limited to 'Source/WebCore/platform/graphics/android/GLWebViewState.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
index 9978327..c821523 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -83,6 +83,8 @@ GLWebViewState::GLWebViewState(android::Mutex* buttonMutex)
, m_focusRingTexture(-1)
, m_goingDown(true)
, m_goingLeft(false)
+ , m_expandedTileBoundsX(0)
+ , m_expandedTileBoundsY(0)
{
m_viewport.setEmpty();
m_previousViewport.setEmpty();
@@ -426,12 +428,11 @@ void GLWebViewState::swapPages()
int GLWebViewState::baseContentWidth()
{
- return m_currentBaseLayer ? m_currentBaseLayer->getWidth() : 0;
-
+ return m_currentBaseLayer ? m_currentBaseLayer->content()->width() : 0;
}
int GLWebViewState::baseContentHeight()
{
- return m_currentBaseLayer ? m_currentBaseLayer->getHeight() : 0;
+ return m_currentBaseLayer ? m_currentBaseLayer->content()->height() : 0;
}
void GLWebViewState::setViewport(SkRect& viewport, float scale)
@@ -455,8 +456,8 @@ 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() + TilesManager::instance()->expandedTileBoundsX() * 2 + 1) *
- (m_viewportTileBounds.height() + TilesManager::instance()->expandedTileBoundsY() * 2 + 1) * 2;
+ int maxTextureCount = (m_viewportTileBounds.width() + TILE_PREFETCH_DISTANCE * 2 + 1) *
+ (m_viewportTileBounds.height() + TILE_PREFETCH_DISTANCE * 2 + 1) * 2;
TilesManager::instance()->setMaxTextureCount(maxTextureCount);
m_tiledPageA->updateBaseTileSize();
m_tiledPageB->updateBaseTileSize();
@@ -532,6 +533,13 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect,
return false;
}
+ float viewWidth = (viewport.fRight - viewport.fLeft) * TILE_PREFETCH_RATIO;
+ float viewHeight = (viewport.fBottom - viewport.fTop) * TILE_PREFETCH_RATIO;
+ bool useHorzPrefetch = viewWidth < baseContentWidth();
+ bool useVertPrefetch = viewHeight < baseContentHeight();
+ m_expandedTileBoundsX = (useHorzPrefetch) ? TILE_PREFETCH_DISTANCE : 0;
+ m_expandedTileBoundsY = (useVertPrefetch) ? TILE_PREFETCH_DISTANCE : 0;
+
XLOG("drawGL, rect(%d, %d, %d, %d), viewport(%.2f, %.2f, %.2f, %.2f)",
rect.x(), rect.y(), rect.width(), rect.height(),
viewport.fLeft, viewport.fTop, viewport.fRight, viewport.fBottom);