summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/android/LayerAndroid.cpp
diff options
context:
space:
mode:
authorNicolas Roard <nicolas@android.com>2011-01-26 14:46:30 -0800
committerNicolas Roard <nicolas@android.com>2011-01-26 14:46:30 -0800
commit4c0f1a51d7d3b51a1f241aa700f9ed5b3b23998c (patch)
treeb43179d9105c4e5e6c968662f99eb0e5fa48b1e6 /WebCore/platform/graphics/android/LayerAndroid.cpp
parented03e47015ce173c535ea9da8b61548db718e80e (diff)
downloadexternal_webkit-4c0f1a51d7d3b51a1f241aa700f9ed5b3b23998c.zip
external_webkit-4c0f1a51d7d3b51a1f241aa700f9ed5b3b23998c.tar.gz
external_webkit-4c0f1a51d7d3b51a1f241aa700f9ed5b3b23998c.tar.bz2
Fix the flickering bug. We return any previous textures used by the
layer until we get the new one ready. bug:3391157 bug:3393571 Change-Id: I81dce23f79be788c3c0bfb0ccfd54d08156dfe3f
Diffstat (limited to 'WebCore/platform/graphics/android/LayerAndroid.cpp')
-rw-r--r--WebCore/platform/graphics/android/LayerAndroid.cpp35
1 files changed, 22 insertions, 13 deletions
diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp
index 03bb11d..77a948a 100644
--- a/WebCore/platform/graphics/android/LayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/LayerAndroid.cpp
@@ -77,7 +77,7 @@ LayerAndroid::LayerAndroid(bool isRootLayer) : SkLayer(),
m_uniqueId(++gUniqueId),
m_drawingTexture(0),
m_reservedTexture(0),
- m_pictureUsed(-1),
+ m_pictureUsed(0),
m_requestSent(false),
m_scale(1)
{
@@ -594,12 +594,20 @@ void LayerAndroid::reserveGLTextures()
IntRect cr = TilesManager::instance()->shader()->clippedRectWithViewport(tr);
m_layerTextureRect = drawTransform().inverse().mapRect(cr);
- reservedTexture = TilesManager::instance()->getExistingTextureForLayer(this, m_layerTextureRect);
+ reservedTexture = TilesManager::instance()->getExistingTextureForLayer(
+ this, m_layerTextureRect);
// If we do not have a drawing texture (i.e. new LayerAndroid tree),
// we get any one available.
- if (!m_drawingTexture)
- m_drawingTexture = TilesManager::instance()->getExistingTextureForLayer(this, m_layerTextureRect, true);
+ if (!m_drawingTexture) {
+ LayerTexture* texture = reservedTexture;
+ m_drawingTexture =
+ TilesManager::instance()->getExistingTextureForLayer(
+ this, m_layerTextureRect, true, texture);
+
+ if (!m_drawingTexture)
+ m_drawingTexture = reservedTexture;
+ }
}
// SMP flush
@@ -636,6 +644,7 @@ void LayerAndroid::createGLTextures()
m_atomicSync.unlock();
if (reservedTexture &&
+ reservedTexture->ready() &&
(reservedTexture != m_drawingTexture)) {
if (m_drawingTexture) {
TilesManager::instance()->removeOperationsForTexture(m_drawingTexture);
@@ -668,13 +677,10 @@ bool LayerAndroid::needsScheduleRepaint(LayerTexture* texture)
if (!texture)
return false;
- if (m_pictureUsed == -1 ||
- texture->pictureUsed() == -1 ||
+ if (!texture->ready() ||
texture->pictureUsed() != m_pictureUsed) {
XLOG("We mark layer %d (%x) as dirty because: m_pictureUsed(%d == 0?), texture picture used %x",
uniqueId(), this, m_pictureUsed, texture->pictureUsed());
- if (m_pictureUsed == -1)
- m_pictureUsed = 0;
m_dirty = true;
}
@@ -705,8 +711,10 @@ bool LayerAndroid::drawGL(SkMatrix& matrix)
// move the drawing depending on where the texture is on the layer
TransformationMatrix m = drawTransform();
m.translate(textureRect.x(), textureRect.y());
- XLOG("LayerAndroid %d %x (%.2f, %.2f) drawGL (texture %x, %d, %d, %d, %d)", uniqueId(), this, getWidth(), getHeight(),
- m_drawingTexture, textureRect.x(), textureRect.y(), textureRect.width(), textureRect.height());
+ XLOG("LayerAndroid %d %x (%.2f, %.2f) drawGL (texture %x, %d, %d, %d, %d)",
+ uniqueId(), this, getWidth(), getHeight(),
+ m_drawingTexture, textureRect.x(), textureRect.y(),
+ textureRect.width(), textureRect.height());
TilesManager::instance()->shader()->drawLayerQuad(m, bounds,
textureInfo->m_textureId,
m_drawOpacity);
@@ -768,7 +776,7 @@ void LayerAndroid::paintBitmapGL()
return;
}
- XLOG("LayerAndroid paintBitmapGL (layer %d), texture used %x (%d, %d)", uniqueId(), texture,
+ XLOG("LayerAndroid %d paintBitmapGL, texture used %x (%d, %d)", uniqueId(), texture,
texture->rect().width(), texture->rect().height());
// We need to mark the texture as busy before relinquishing the lock
@@ -805,12 +813,13 @@ void LayerAndroid::paintBitmapGL()
m_atomicSync.lock();
m_dirty = false;
m_requestSent = false;
- texture->setPictureUsed(m_pictureUsed);
- m_atomicSync.unlock();
XLOG("LayerAndroid %d paintBitmapGL PAINTING DONE, updating the texture", uniqueId());
texture->producerUpdate(textureInfo);
+ texture->setPictureUsed(m_pictureUsed);
+ m_atomicSync.unlock();
+
XLOG("LayerAndroid %d paintBitmapGL UPDATING DONE", uniqueId());
}