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/GLUtils.cpp10
-rw-r--r--WebCore/platform/graphics/android/LayerAndroid.cpp30
-rw-r--r--WebCore/platform/graphics/android/LayerTexture.cpp51
-rw-r--r--WebCore/platform/graphics/android/LayerTexture.h7
4 files changed, 23 insertions, 75 deletions
diff --git a/WebCore/platform/graphics/android/GLUtils.cpp b/WebCore/platform/graphics/android/GLUtils.cpp
index 7a8fd26..b62072b 100644
--- a/WebCore/platform/graphics/android/GLUtils.cpp
+++ b/WebCore/platform/graphics/android/GLUtils.cpp
@@ -316,6 +316,16 @@ void GLUtils::createTextureWithBitmap(GLuint texture, SkBitmap& bitmap, GLint fi
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
+
+ // The following is a workaround -- remove when EGLImage texture upload is fixed.
+ GLuint fboID;
+ glGenFramebuffers(1, &fboID);
+ glBindFramebuffer(GL_FRAMEBUFFER, fboID);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
+ glCheckFramebufferStatus(GL_FRAMEBUFFER); // should return GL_FRAMEBUFFER_COMPLETE
+
+ glBindFramebuffer(GL_FRAMEBUFFER, 0); // rebind the standard FBO
+ glDeleteFramebuffers(1, &fboID);
}
void GLUtils::updateTextureWithBitmap(GLuint texture, SkBitmap& bitmap, GLint filter)
diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp
index 2f55292..03bb11d 100644
--- a/WebCore/platform/graphics/android/LayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/LayerAndroid.cpp
@@ -636,8 +636,7 @@ void LayerAndroid::createGLTextures()
m_atomicSync.unlock();
if (reservedTexture &&
- (reservedTexture != m_drawingTexture) &&
- reservedTexture->isReady()) {
+ (reservedTexture != m_drawingTexture)) {
if (m_drawingTexture) {
TilesManager::instance()->removeOperationsForTexture(m_drawingTexture);
m_drawingTexture->release(this);
@@ -652,8 +651,8 @@ void LayerAndroid::createGLTextures()
if (!m_requestSent) {
m_requestSent = true;
m_atomicSync.unlock();
- XLOG("We schedule a paint for layer %d (%x), because isReady %d or m_dirty %d, using texture %x (%d, %d)",
- uniqueId(), this, m_reservedTexture->isReady(), m_dirty, m_reservedTexture,
+ XLOG("We schedule a paint for layer %d (%x), because m_dirty %d, using texture %x (%d, %d)",
+ uniqueId(), this, m_dirty, m_reservedTexture,
m_reservedTexture->rect().width(), m_reservedTexture->rect().height());
PaintLayerOperation* operation = new PaintLayerOperation(this);
TilesManager::instance()->scheduleOperation(operation);
@@ -669,18 +668,16 @@ bool LayerAndroid::needsScheduleRepaint(LayerTexture* texture)
if (!texture)
return false;
- if (!m_pictureUsed == -1 || texture->pictureUsed() != m_pictureUsed) {
+ if (m_pictureUsed == -1 ||
+ texture->pictureUsed() == -1 ||
+ 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;
- texture->setPictureUsed(m_pictureUsed);
m_dirty = true;
}
- if (!texture->isReady())
- m_dirty = true;
-
return m_dirty;
}
@@ -701,7 +698,7 @@ bool LayerAndroid::drawGL(SkMatrix& matrix)
if (prepareContext() && m_drawingTexture) {
TextureInfo* textureInfo = m_drawingTexture->consumerLock();
- if (textureInfo && m_drawingTexture->isReady()) {
+ if (textureInfo) {
SkRect bounds;
IntRect textureRect = m_drawingTexture->rect();
bounds.set(0, 0, textureRect.width(), textureRect.height());
@@ -805,18 +802,15 @@ void LayerAndroid::paintBitmapGL()
contentDraw(canvas);
canvas->restore();
- XLOG("LayerAndroid %d paintBitmapGL PAINTING DONE, updating the texture", uniqueId());
- texture->producerUpdate(textureInfo);
-
- while (!texture->isReady()) {
- TextureInfo* textureInfo = texture->producerLock();
- texture->producerUpdate(textureInfo);
- }
-
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);
+
XLOG("LayerAndroid %d paintBitmapGL UPDATING DONE", uniqueId());
}
diff --git a/WebCore/platform/graphics/android/LayerTexture.cpp b/WebCore/platform/graphics/android/LayerTexture.cpp
deleted file mode 100644
index 294c3d3..0000000
--- a/WebCore/platform/graphics/android/LayerTexture.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "LayerTexture.h"
-
-#define DOUBLE_BUFFERED_TEXTURE_MINIMUM_ACCESS 3
-
-void LayerTexture::producerUpdate(TextureInfo* textureInfo)
-{
- update();
- BackedDoubleBufferedTexture::producerUpdate(textureInfo);
-}
-
-void LayerTexture::update()
-{
- // FIXME: fix the double buffered texture class instead of doing this
- // this is a stop gap measure and should be removed.
- // Right now we have to update the textures 3 times (one create, two
- // updates) before we can be sure to have a non-corrupted texture
- // to display.
- if (m_textureUpdates < DOUBLE_BUFFERED_TEXTURE_MINIMUM_ACCESS)
- m_textureUpdates++;
-}
-
-bool LayerTexture::isReady()
-{
- return m_textureUpdates == DOUBLE_BUFFERED_TEXTURE_MINIMUM_ACCESS;
-}
diff --git a/WebCore/platform/graphics/android/LayerTexture.h b/WebCore/platform/graphics/android/LayerTexture.h
index 3654476..fb1b9fb 100644
--- a/WebCore/platform/graphics/android/LayerTexture.h
+++ b/WebCore/platform/graphics/android/LayerTexture.h
@@ -38,8 +38,7 @@ class LayerTexture : public BackedDoubleBufferedTexture {
: BackedDoubleBufferedTexture(w, h, config)
, m_id(0)
, m_scale(1)
- , m_pictureUsed(0)
- , m_textureUpdates(0)
+ , m_pictureUsed(-1)
{}
virtual ~LayerTexture() {};
@@ -48,21 +47,17 @@ class LayerTexture : public BackedDoubleBufferedTexture {
unsigned int pictureUsed() { return m_pictureUsed; }
void setPictureUsed(unsigned pictureUsed) { m_pictureUsed = pictureUsed; }
- bool isReady();
- virtual void producerUpdate(TextureInfo* textureInfo);
void setRect(const IntRect& r) { m_rect = r; }
IntRect& rect() { return m_rect; }
float scale() { return m_scale; }
void setScale(float scale) { m_scale = scale; }
private:
- void update();
int m_id;
IntRect m_rect;
float m_scale;
unsigned int m_pictureUsed;
- unsigned int m_textureUpdates;
};
} // namespace WebCore