diff options
-rw-r--r-- | Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp | 41 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h | 4 |
2 files changed, 29 insertions, 16 deletions
diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp index 7c8f570..b8d751c 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp @@ -42,6 +42,7 @@ SurfaceBacking::SurfaceBacking(bool isBaseSurface) { m_frontTexture = new TileGrid(isBaseSurface); m_backTexture = new TileGrid(isBaseSurface); + m_lowResTexture = new TileGrid(isBaseSurface); m_scale = -1; m_futureScale = -1; m_zooming = false; @@ -51,6 +52,7 @@ SurfaceBacking::~SurfaceBacking() { delete m_frontTexture; delete m_backTexture; + delete m_lowResTexture; } void SurfaceBacking::prepareGL(GLWebViewState* state, bool allowZoom, @@ -70,6 +72,9 @@ void SurfaceBacking::prepareGL(GLWebViewState* state, bool allowZoom, m_futureScale = scale; m_zoomUpdateTime = WTF::currentTime() + SurfaceBacking::s_zoomUpdateDelay; m_zooming = true; + + // release back texture's TileTextures, so they can be reused immediately + m_backTexture->discardTextures(); } bool useExpandPrefetch = aggressiveRendering; @@ -77,39 +82,43 @@ void SurfaceBacking::prepareGL(GLWebViewState* state, bool allowZoom, this, scale, m_scale, m_futureScale, m_zooming, m_frontTexture, m_backTexture); - if (!m_zooming) { - m_frontTexture->prepareGL(state, m_scale, - prepareArea, unclippedArea, painter, false, useExpandPrefetch); - if (aggressiveRendering) { - // prepare the back tiled texture to render content in low res - float lowResPrefetchScale = m_scale * LOW_RES_PREFETCH_SCALE_MODIFIER; - m_backTexture->prepareGL(state, lowResPrefetchScale, - prepareArea, unclippedArea, painter, true, useExpandPrefetch); - m_backTexture->swapTiles(); - } - } else if (m_zoomUpdateTime < WTF::currentTime()) { + if (m_zooming && (m_zoomUpdateTime < WTF::currentTime())) { m_backTexture->prepareGL(state, m_futureScale, - prepareArea, unclippedArea, painter, false, useExpandPrefetch); + prepareArea, unclippedArea, painter, false, false); if (m_backTexture->isReady()) { // zooming completed, swap the textures and new front tiles swapTileGrids(); m_frontTexture->swapTiles(); m_backTexture->discardTextures(); + m_lowResTexture->discardTextures(); m_scale = m_futureScale; m_zooming = false; } } + + if (!m_zooming) { + m_frontTexture->prepareGL(state, m_scale, + prepareArea, unclippedArea, painter, false, useExpandPrefetch); + if (aggressiveRendering) { + // prepare low res content + float lowResPrefetchScale = m_scale * LOW_RES_PREFETCH_SCALE_MODIFIER; + m_lowResTexture->prepareGL(state, lowResPrefetchScale, + prepareArea, unclippedArea, painter, + true, useExpandPrefetch); + m_lowResTexture->swapTiles(); + } + } } void SurfaceBacking::drawGL(const IntRect& visibleArea, float opacity, const TransformationMatrix* transform, bool aggressiveRendering, const Color* background) { - // draw low res prefetch page, if needed - if (aggressiveRendering && !m_zooming && m_frontTexture->isMissingContent()) - m_backTexture->drawGL(visibleArea, opacity, transform); + // draw low res prefetch page if zooming or front texture missing content + if (aggressiveRendering && isMissingContent()) + m_lowResTexture->drawGL(visibleArea, opacity, transform); m_frontTexture->drawGL(visibleArea, opacity, transform, background); } @@ -118,12 +127,14 @@ void SurfaceBacking::markAsDirty(const SkRegion& dirtyArea) { m_backTexture->markAsDirty(dirtyArea); m_frontTexture->markAsDirty(dirtyArea); + m_lowResTexture->markAsDirty(dirtyArea); } void SurfaceBacking::swapTiles() { m_backTexture->swapTiles(); m_frontTexture->swapTiles(); + m_lowResTexture->swapTiles(); } void SurfaceBacking::computeTexturesAmount(TexturesResult* result, LayerAndroid* layer) diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h index ec01dbe..bbac9b5 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h @@ -61,7 +61,7 @@ public: bool isMissingContent() { - return !m_zooming && m_frontTexture->isMissingContent(); + return m_zooming || m_frontTexture->isMissingContent(); } int nbTextures(IntRect& area, float scale) @@ -80,6 +80,8 @@ private: TileGrid* m_frontTexture; TileGrid* m_backTexture; + TileGrid* m_lowResTexture; + float m_scale; float m_futureScale; double m_zoomUpdateTime; |