summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/android
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/graphics/android')
-rw-r--r--WebCore/platform/graphics/android/LayerAndroid.cpp35
-rw-r--r--WebCore/platform/graphics/android/LayerTexture.h12
-rw-r--r--WebCore/platform/graphics/android/TilesManager.cpp7
-rw-r--r--WebCore/platform/graphics/android/TilesManager.h2
4 files changed, 38 insertions, 18 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());
}
diff --git a/WebCore/platform/graphics/android/LayerTexture.h b/WebCore/platform/graphics/android/LayerTexture.h
index fb1b9fb..042422d 100644
--- a/WebCore/platform/graphics/android/LayerTexture.h
+++ b/WebCore/platform/graphics/android/LayerTexture.h
@@ -38,15 +38,22 @@ class LayerTexture : public BackedDoubleBufferedTexture {
: BackedDoubleBufferedTexture(w, h, config)
, m_id(0)
, m_scale(1)
- , m_pictureUsed(-1)
+ , m_pictureUsed(0)
+ , m_ready(false)
{}
virtual ~LayerTexture() {};
int id() { return m_id; }
void setId(int id) { m_id = id; }
+ bool ready() { return m_ready; }
unsigned int pictureUsed() { return m_pictureUsed; }
- void setPictureUsed(unsigned pictureUsed) { m_pictureUsed = pictureUsed; }
+ void setPictureUsed(unsigned pictureUsed)
+ {
+ if (!m_ready)
+ m_ready = true;
+ m_pictureUsed = pictureUsed;
+ }
void setRect(const IntRect& r) { m_rect = r; }
IntRect& rect() { return m_rect; }
float scale() { return m_scale; }
@@ -58,6 +65,7 @@ class LayerTexture : public BackedDoubleBufferedTexture {
IntRect m_rect;
float m_scale;
unsigned int m_pictureUsed;
+ bool m_ready;
};
} // namespace WebCore
diff --git a/WebCore/platform/graphics/android/TilesManager.cpp b/WebCore/platform/graphics/android/TilesManager.cpp
index 1655016..16282c4 100644
--- a/WebCore/platform/graphics/android/TilesManager.cpp
+++ b/WebCore/platform/graphics/android/TilesManager.cpp
@@ -80,7 +80,7 @@ TilesManager::TilesManager()
m_textures.append(reinterpret_cast<BackedDoubleBufferedTexture*>(
android_atomic_acquire_load(reinterpret_cast<int32_t*>(&texture))));
}
- XLOG("TilesManager ctor");
+ XLOG("TilesManager ctor - init textures done");
m_pixmapsGenerationThread = new TexturesGenerator();
m_pixmapsGenerationThread->run("TexturesGenerator");
@@ -232,7 +232,8 @@ BackedDoubleBufferedTexture* TilesManager::getAvailableTexture(BaseTile* owner)
LayerTexture* TilesManager::getExistingTextureForLayer(LayerAndroid* layer,
const IntRect& rect,
- bool any)
+ bool any,
+ LayerTexture* texture)
{
android::Mutex::Autolock lock(m_texturesLock);
for (unsigned int i = 0; i< m_layersTextures.size(); i++) {
@@ -242,6 +243,8 @@ LayerTexture* TilesManager::getExistingTextureForLayer(LayerAndroid* layer,
continue;
if (!any && layer->getScale() != m_layersTextures[i]->scale())
continue;
+ if (any && texture == m_layersTextures[i])
+ continue;
XLOG("return layer %d (%x) for tile %d (%x)",
i, m_layersTextures[i],
diff --git a/WebCore/platform/graphics/android/TilesManager.h b/WebCore/platform/graphics/android/TilesManager.h
index c09a388..0338ece 100644
--- a/WebCore/platform/graphics/android/TilesManager.h
+++ b/WebCore/platform/graphics/android/TilesManager.h
@@ -72,7 +72,7 @@ public:
void printLayersTextures(const char* s);
void cleanupLayersTextures(LayerAndroid* layer, bool forceCleanup = false);
LayerTexture* getExistingTextureForLayer(LayerAndroid* layer, const IntRect& rect,
- bool any = false);
+ bool any = false, LayerTexture* texture = 0);
LayerTexture* createTextureForLayer(LayerAndroid* layer, const IntRect& rect);
void markGeneratorAsReady()