summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2012-04-12 13:41:17 -0700
committerChris Craik <ccraik@google.com>2012-04-12 15:35:57 -0700
commitc884cf63d8cee0f30269e4ec7cbe2a6101fae686 (patch)
treea25352da00da50c7f99844086103d6ad67003c27 /Source/WebCore/platform/graphics
parent85213faae54abd12e8debbf768235403a22faa03 (diff)
downloadexternal_webkit-c884cf63d8cee0f30269e4ec7cbe2a6101fae686.zip
external_webkit-c884cf63d8cee0f30269e4ec7cbe2a6101fae686.tar.gz
external_webkit-c884cf63d8cee0f30269e4ec7cbe2a6101fae686.tar.bz2
Separate prefetching TileGrid from front/back
Can now draw all available tiles while preparing new zoom level bug:5690291 Change-Id: Ic08acc59e052d6b05d282329eed2cc526cb8f2f3
Diffstat (limited to 'Source/WebCore/platform/graphics')
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp41
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h4
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;