summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/android
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2010-12-10 14:26:26 -0800
committerTeng-Hui Zhu <ztenghui@google.com>2010-12-13 11:04:58 -0800
commitc9ab9bf00ba3ce8289f917675f81b40e4438a864 (patch)
tree0250b0a08f85f41ad768734f0d716753d279ce3a /WebCore/platform/graphics/android
parent57447b53a088f0e3b0ee75ef043db7224aac25ae (diff)
downloadexternal_webkit-c9ab9bf00ba3ce8289f917675f81b40e4438a864.zip
external_webkit-c9ab9bf00ba3ce8289f917675f81b40e4438a864.tar.gz
external_webkit-c9ab9bf00ba3ce8289f917675f81b40e4438a864.tar.bz2
Prevent the usage of the texture(tile) if considered un-usable
As an example of gmail, even though clearView is called, the previous content still show up. This fix just use a usable flag to make sure the content in the previously used texture is not showing up. bug : 3215000 Change-Id: I5429a4d03547d4cd4ad10bd2153c247a4d40db7d
Diffstat (limited to 'WebCore/platform/graphics/android')
-rw-r--r--WebCore/platform/graphics/android/BaseTile.cpp22
-rw-r--r--WebCore/platform/graphics/android/BaseTile.h4
-rw-r--r--WebCore/platform/graphics/android/GLWebViewState.cpp7
-rw-r--r--WebCore/platform/graphics/android/TiledPage.cpp9
-rw-r--r--WebCore/platform/graphics/android/TiledPage.h2
5 files changed, 38 insertions, 6 deletions
diff --git a/WebCore/platform/graphics/android/BaseTile.cpp b/WebCore/platform/graphics/android/BaseTile.cpp
index 0f4ab4f..5701486 100644
--- a/WebCore/platform/graphics/android/BaseTile.cpp
+++ b/WebCore/platform/graphics/android/BaseTile.cpp
@@ -73,6 +73,7 @@ BaseTile::BaseTile()
, m_texture(0)
, m_scale(1)
, m_dirty(true)
+ , m_usable(true)
, m_lastDirtyPicture(0)
, m_lastPaintedPicture(0)
{
@@ -84,7 +85,7 @@ BaseTile::BaseTile()
BaseTile::~BaseTile()
{
setUsedLevel(-1);
- if(m_texture)
+ if (m_texture)
m_texture->release(this);
#ifdef DEBUG_COUNT
@@ -138,6 +139,13 @@ void BaseTile::markAsDirty(int unsigned pictureCount)
m_dirty = true;
}
+void BaseTile::setUsable(bool usable)
+{
+ android::AutoMutex lock(m_atomicSync);
+ m_usable = usable;
+}
+
+
bool BaseTile::isDirty()
{
android::AutoMutex lock(m_atomicSync);
@@ -159,6 +167,12 @@ void BaseTile::draw(float transparency, SkRect& rect)
return;
}
+ // Early return if set to un-usable in purpose!
+ if (!m_usable) {
+ XLOG("early return at BaseTile::draw b/c tile set to unusable !");
+ return;
+ }
+
TextureInfo* textureInfo = m_texture->consumerLock();
if (!textureInfo) {
XLOG("%x (%d, %d) trying to draw, but no textureInfo!", this, x(), y());
@@ -201,7 +215,7 @@ void BaseTile::paintBitmap()
float scale = m_scale;
m_atomicSync.unlock();
- if(!dirty || !texture)
+ if (!dirty || !texture)
return;
const int x = m_x;
@@ -251,8 +265,10 @@ void BaseTile::paintBitmap()
m_atomicSync.lock();
m_lastPaintedPicture = pictureCount;
- if (m_lastPaintedPicture >= m_lastDirtyPicture)
+ if (m_lastPaintedPicture >= m_lastDirtyPicture) {
m_dirty = false;
+ m_usable = true;
+ }
m_atomicSync.unlock();
}
diff --git a/WebCore/platform/graphics/android/BaseTile.h b/WebCore/platform/graphics/android/BaseTile.h
index 8f095e3..22e85d1 100644
--- a/WebCore/platform/graphics/android/BaseTile.h
+++ b/WebCore/platform/graphics/android/BaseTile.h
@@ -81,7 +81,7 @@ public:
void markAsDirty(const unsigned int pictureCount);
bool isDirty();
-
+ void setUsable(bool usable);
float scale() const { return m_scale; }
void setScale(float scale);
@@ -101,6 +101,8 @@ private:
float m_scale;
// used to signal that the that the tile is out-of-date and needs to be redrawn
bool m_dirty;
+ // used to signal whether or not the draw can use this tile.
+ bool m_usable;
// stores the id of the latest picture from webkit that caused this tile to
// become dirty. A tile is no longer dirty when it has been painted with a
// picture that is newer than this value.
diff --git a/WebCore/platform/graphics/android/GLWebViewState.cpp b/WebCore/platform/graphics/android/GLWebViewState.cpp
index 9bca91a..7c2f851 100644
--- a/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -97,6 +97,10 @@ GLWebViewState::~GLWebViewState()
void GLWebViewState::setBaseLayer(BaseLayerAndroid* layer, const IntRect& rect)
{
android::Mutex::Autolock lock(m_baseLayerLock);
+ if (!layer) {
+ m_tiledPageA->setUsable(false);
+ m_tiledPageB->setUsable(false);
+ }
if (m_baseLayer && layer)
m_baseLayer->swapExtra(layer);
m_baseLayer = layer;
@@ -233,7 +237,8 @@ void GLWebViewState::setViewport(SkRect& viewport, float scale)
static_cast<int>(ceilf(viewport.fBottom * invTileContentHeight)));
}
-bool GLWebViewState::hasContent() {
+bool GLWebViewState::hasContent()
+{
android::Mutex::Autolock lock(m_baseLayerLock);
return m_baseLayer;
}
diff --git a/WebCore/platform/graphics/android/TiledPage.cpp b/WebCore/platform/graphics/android/TiledPage.cpp
index 3a08f9b..1d2754d 100644
--- a/WebCore/platform/graphics/android/TiledPage.cpp
+++ b/WebCore/platform/graphics/android/TiledPage.cpp
@@ -105,6 +105,15 @@ BaseTile* TiledPage::getBaseTile(int x, int y) const
return 0;
}
+void TiledPage::setUsable(bool usable)
+{
+ for (int j = 0; j < m_baseTileSize; j++) {
+ BaseTile& tile = m_baseTiles[j];
+ tile.setUsable(usable);
+ }
+ return;
+}
+
void TiledPage::invalidateRect(const IntRect& inval, const unsigned int pictureCount)
{
// Given the current scale level we need to mark the appropriate tiles as dirty
diff --git a/WebCore/platform/graphics/android/TiledPage.h b/WebCore/platform/graphics/android/TiledPage.h
index fa310bf..ad88bc4 100644
--- a/WebCore/platform/graphics/android/TiledPage.h
+++ b/WebCore/platform/graphics/android/TiledPage.h
@@ -75,7 +75,7 @@ public:
void setScale(float scale) { m_scale = scale; m_invScale = 1 / scale; }
void invalidateRect(const IntRect& invalRect, const unsigned int pictureCount);
-
+ void setUsable(bool usable);
private:
void updateTileState(const SkIRect& tileBounds);
void prepareRow(bool goingLeft, int tilesInRow, int firstTileX, int y, TileSet* set);