summaryrefslogtreecommitdiffstats
path: root/WebCore
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore')
-rw-r--r--WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp14
-rw-r--r--WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h1
-rw-r--r--WebCore/platform/graphics/android/BaseTile.cpp31
-rw-r--r--WebCore/platform/graphics/android/GLUtils.cpp4
-rw-r--r--WebCore/platform/graphics/android/GLWebViewState.cpp3
-rw-r--r--WebCore/platform/graphics/android/TilesManager.cpp5
6 files changed, 39 insertions, 19 deletions
diff --git a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp
index 63c9806..dc0962c 100644
--- a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp
+++ b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp
@@ -202,6 +202,20 @@ bool BackedDoubleBufferedTexture::acquire(TextureOwner* owner)
return setOwner(owner);
}
+bool BackedDoubleBufferedTexture::tryAcquire(TextureOwner* owner, TiledPage* currentPage, TiledPage* nextPage)
+{
+ m_busyLock.lock();
+ if (!m_busy
+ && m_owner
+ && m_owner->page() != currentPage
+ && m_owner->page() != nextPage) {
+ m_busyLock.unlock();
+ return this->acquire(owner);
+ }
+ m_busyLock.unlock();
+ return false;
+}
+
bool BackedDoubleBufferedTexture::setOwner(TextureOwner* owner)
{
// if the writable texture is busy (i.e. currently being written to) then we
diff --git a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h
index f612114..8bfae59 100644
--- a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h
+++ b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h
@@ -90,6 +90,7 @@ public:
// returns false if ownership cannot be transferred because the tile is busy
bool acquire(TextureOwner* owner);
bool release(TextureOwner* owner);
+ bool tryAcquire(TextureOwner* owner, TiledPage* currentPage, TiledPage* nextPage);
// set the texture owner if not busy. Return false if busy, true otherwise.
bool setOwner(TextureOwner* owner);
diff --git a/WebCore/platform/graphics/android/BaseTile.cpp b/WebCore/platform/graphics/android/BaseTile.cpp
index be0ccf6..0296d21 100644
--- a/WebCore/platform/graphics/android/BaseTile.cpp
+++ b/WebCore/platform/graphics/android/BaseTile.cpp
@@ -332,23 +332,30 @@ void BaseTile::paintBitmap()
SkRect dirtyRect;
dirtyRect.set(cliperator.rect());
- SkRect tileRect;
- tileRect.fLeft = x * tileWidth / scale;
- tileRect.fTop = y * tileHeight / scale;
- tileRect.fRight = tileRect.fLeft + (tileWidth / scale);
- tileRect.fBottom = tileRect.fTop + (tileHeight / scale);
+ float left = x * tileWidth;
+ float top = y * tileHeight;
- if (!tileRect.intersect(dirtyRect)) {
+ // compute the rect to corresponds to pixels
+ SkRect realTileRect;
+ realTileRect.fLeft = left;
+ realTileRect.fTop = top;
+ realTileRect.fRight = left + tileWidth;
+ realTileRect.fBottom = top + tileHeight;
+
+ // scale the dirtyRect for intersect computation.
+ SkRect realDirtyRect = SkRect::MakeWH(dirtyRect.width() * scale,
+ dirtyRect.height() * scale);
+ realDirtyRect.offset(dirtyRect.fLeft * scale, dirtyRect.fTop * scale);
+
+ if (!realTileRect.intersect(realDirtyRect)) {
cliperator.next();
continue;
}
- // recompute the rect to corresponds to pixels
- SkRect realTileRect;
- realTileRect.fLeft = floorf(tileRect.fLeft * scale);
- realTileRect.fTop = floorf(tileRect.fTop * scale);
- realTileRect.fRight = ceilf(tileRect.fRight * scale);
- realTileRect.fBottom = ceilf(tileRect.fBottom * scale);
+ realTileRect.fLeft = floorf(realTileRect.fLeft);
+ realTileRect.fTop = floorf(realTileRect.fTop);
+ realTileRect.fRight = ceilf(realTileRect.fRight);
+ realTileRect.fBottom = ceilf(realTileRect.fBottom);
SkIRect finalRealRect;
finalRealRect.fLeft = static_cast<int>(realTileRect.fLeft) % static_cast<int>(tileWidth);
diff --git a/WebCore/platform/graphics/android/GLUtils.cpp b/WebCore/platform/graphics/android/GLUtils.cpp
index 23bf525..19be5c7 100644
--- a/WebCore/platform/graphics/android/GLUtils.cpp
+++ b/WebCore/platform/graphics/android/GLUtils.cpp
@@ -375,8 +375,8 @@ void GLUtils::updateTextureWithBitmap(GLuint texture, int x, int y, SkBitmap& bi
bitmap.unlockPixels();
if (GLUtils::checkGlError("glTexSubImage2D")) {
XLOG("GL ERROR: glTexSubImage2D parameters are : bitmap.width() %d, bitmap.height() %d,"
- " internalformat 0x%x, type 0x%x, bitmap.getPixels() %p",
- bitmap.width(), bitmap.height(), internalformat, type, bitmap.getPixels());
+ " x %d, y %d, internalformat 0x%x, type 0x%x, bitmap.getPixels() %p",
+ bitmap.width(), bitmap.height(), x, y, internalformat, type, bitmap.getPixels());
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
diff --git a/WebCore/platform/graphics/android/GLWebViewState.cpp b/WebCore/platform/graphics/android/GLWebViewState.cpp
index 189b3f0..e5034d4 100644
--- a/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -313,7 +313,8 @@ void GLWebViewState::swapPages()
android::Mutex::Autolock lock(m_tiledPageLock);
m_usePageA ^= true;
TiledPage* working = m_usePageA ? m_tiledPageB : m_tiledPageA;
- TilesManager::instance()->resetTextureUsage(working);
+ if (m_scaleRequestState != kNoScaleRequest)
+ TilesManager::instance()->resetTextureUsage(working);
m_scaleRequestState = kNoScaleRequest;
}
diff --git a/WebCore/platform/graphics/android/TilesManager.cpp b/WebCore/platform/graphics/android/TilesManager.cpp
index bff1551..34d0546 100644
--- a/WebCore/platform/graphics/android/TilesManager.cpp
+++ b/WebCore/platform/graphics/android/TilesManager.cpp
@@ -201,10 +201,7 @@ BackedDoubleBufferedTexture* TilesManager::getAvailableTexture(BaseTile* owner)
TiledPage* nextPage = currentPage->sibling();
for (unsigned int i = 0; i < max; i++) {
BackedDoubleBufferedTexture* texture = m_textures[i];
- if (texture->owner()
- && texture->owner()->page() != currentPage
- && texture->owner()->page() != nextPage
- && texture->acquire(owner)) {
+ if (texture->tryAcquire(owner, currentPage, nextPage)) {
XLOG("grab a texture that wasn't ours, (%x != %x) at %d => texture %x",
owner->page(), texture->owner()->page(), i, texture);
texture->setUsedLevel(0);