summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2011-09-08 16:54:13 -0700
committerThe Android Automerger <android-build@android.com>2011-09-09 13:33:55 -0700
commit3340859901101ff06458197f30ef417805d23283 (patch)
tree45655a2f22966ce63858b704aa2366a6c8645fff
parentab3edbf9489b21b337a378b88850f06fbdd7d8f8 (diff)
downloadexternal_webkit-3340859901101ff06458197f30ef417805d23283.zip
external_webkit-3340859901101ff06458197f30ef417805d23283.tar.gz
external_webkit-3340859901101ff06458197f30ef417805d23283.tar.bz2
If unlock base layer marks tiles dirty, repaint
bug:5278818 Change-Id: I03206bdc5e95743054c361f235e2d94b835a95d1
-rw-r--r--Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp34
-rw-r--r--Source/WebCore/platform/graphics/android/BaseTile.cpp9
-rw-r--r--Source/WebCore/platform/graphics/android/TiledPage.cpp13
-rw-r--r--Source/WebCore/platform/graphics/android/TiledPage.h5
4 files changed, 39 insertions, 22 deletions
diff --git a/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
index 573ad6b..54290cc 100644
--- a/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
@@ -141,7 +141,10 @@ bool BaseLayerAndroid::drawBasePictureInGL(SkRect& viewport, float scale,
nextTiledPage->setScale(scale);
m_glWebViewState->setFutureViewport(viewportTileBounds);
m_glWebViewState->lockBaseLayerUpdate();
- nextTiledPage->updateTileState(viewportTileBounds);
+
+ // ignore dirtiness return value since while zooming we repaint regardless
+ nextTiledPage->updateTileDirtiness(viewportTileBounds);
+
nextTiledPage->prepare(goingDown, goingLeft, viewportTileBounds,
TiledPage::VisibleBounds);
// Cancel pending paints for the foreground page
@@ -212,24 +215,27 @@ bool BaseLayerAndroid::drawBasePictureInGL(SkRect& viewport, float scale,
*buffersSwappedPtr = true;
}
- // If stuff is happening such that we need a redraw, lock updates to the
- // base layer, and only then start painting.
+
bool needsRedraw = scrolling || zooming || !buffersSwapped;
- if (needsRedraw)
- m_glWebViewState->lockBaseLayerUpdate();
- else
+
+ // if we don't expect to redraw, unlock the invals
+ if (!needsRedraw)
m_glWebViewState->unlockBaseLayerUpdate();
- XLOG("scrolling %d, zooming %d, buffersSwapped %d, needsRedraw %d",
- scrolling, zooming, buffersSwapped, needsRedraw);
+ // if applied invals mark tiles dirty, need to redraw
+ needsRedraw |= tiledPage->updateTileDirtiness(preZoomBounds);
- tiledPage->updateTileState(preZoomBounds);
+ if (needsRedraw) {
+ // lock and paint what's needed unless we're zooming, since the new
+ // tiles won't be relevant soon anyway
+ m_glWebViewState->lockBaseLayerUpdate();
+ if (!zooming)
+ tiledPage->prepare(goingDown, goingLeft, preZoomBounds,
+ TiledPage::ExpandedBounds);
+ }
- // Only paint new textures if the base layer has been locked, but not if
- // we're zooming since the new tiles won't be relevant soon anyway
- if (needsRedraw && !zooming)
- tiledPage->prepare(goingDown, goingLeft, preZoomBounds,
- TiledPage::ExpandedBounds);
+ XLOG("scrolling %d, zooming %d, buffersSwapped %d, needsRedraw %d",
+ scrolling, zooming, buffersSwapped, needsRedraw);
tiledPage->draw(transparency, preZoomBounds);
diff --git a/Source/WebCore/platform/graphics/android/BaseTile.cpp b/Source/WebCore/platform/graphics/android/BaseTile.cpp
index 0a87ffe..8a4c2d5 100644
--- a/Source/WebCore/platform/graphics/android/BaseTile.cpp
+++ b/Source/WebCore/platform/graphics/android/BaseTile.cpp
@@ -35,12 +35,15 @@
#include <cutils/atomic.h>
-#ifdef DEBUG
-
#include <cutils/log.h>
#include <wtf/CurrentTime.h>
#include <wtf/text/CString.h>
+#undef XLOGC
+#define XLOGC(...) android_printLog(ANDROID_LOG_DEBUG, "BaseTile", __VA_ARGS__)
+
+#ifdef DEBUG
+
#undef XLOG
#define XLOG(...) android_printLog(ANDROID_LOG_DEBUG, "BaseTile", __VA_ARGS__)
@@ -432,6 +435,8 @@ void BaseTile::paintBitmap()
if (!m_dirtyArea[m_currentDirtyAreaIndex].isEmpty())
m_dirty = true;
+ XLOG("painted tile %p (%d, %d), dirty=%d", this, x, y, m_dirty);
+
if (!m_dirty)
m_isSwapNeeded = true;
}
diff --git a/Source/WebCore/platform/graphics/android/TiledPage.cpp b/Source/WebCore/platform/graphics/android/TiledPage.cpp
index b6a0c47..78140fa 100644
--- a/Source/WebCore/platform/graphics/android/TiledPage.cpp
+++ b/Source/WebCore/platform/graphics/android/TiledPage.cpp
@@ -202,27 +202,32 @@ void TiledPage::prepareRow(bool goingLeft, int tilesInRow, int firstTileX, int y
}
}
-void TiledPage::updateTileState(const SkIRect& tileBounds)
+bool TiledPage::updateTileDirtiness(const SkIRect& tileBounds)
{
if (!m_glWebViewState || tileBounds.isEmpty()) {
m_invalRegion.setEmpty();
m_invalTilesRegion.setEmpty();
- return;
+ return false;
}
+ bool visibleTileIsDirty = false;
for (int x = 0; x < m_baseTileSize; x++) {
BaseTile& tile = m_baseTiles[x];
// if the tile is in the dirty region then we must invalidate it
- if (m_invalRegion.contains(tile.x(), tile.y()))
+ if (m_invalRegion.contains(tile.x(), tile.y())) {
tile.markAsDirty(m_latestPictureInval, m_invalTilesRegion);
+ if (tileBounds.contains(tile.x(), tile.y()))
+ visibleTileIsDirty = true;
+ }
}
// clear the invalidated region as all tiles within that region have now
// been marked as dirty.
m_invalRegion.setEmpty();
m_invalTilesRegion.setEmpty();
+ return visibleTileIsDirty;
}
void TiledPage::prepare(bool goingDown, bool goingLeft, const SkIRect& tileBounds, PrepareBounds bounds)
@@ -231,8 +236,6 @@ void TiledPage::prepare(bool goingDown, bool goingLeft, const SkIRect& tileBound
return;
TilesManager::instance()->gatherTextures();
- // update the tiles distance from the viewport
- updateTileState(tileBounds);
m_scrollingDown = goingDown;
int firstTileX = tileBounds.fLeft;
diff --git a/Source/WebCore/platform/graphics/android/TiledPage.h b/Source/WebCore/platform/graphics/android/TiledPage.h
index 14306eb..946421c 100644
--- a/Source/WebCore/platform/graphics/android/TiledPage.h
+++ b/Source/WebCore/platform/graphics/android/TiledPage.h
@@ -68,7 +68,10 @@ public:
// prepare the page for display on the screen
void prepare(bool goingDown, bool goingLeft, const SkIRect& tileBounds, PrepareBounds bounds);
- void updateTileState(const SkIRect& tileBounds);
+
+ // update tiles with inval information, return true if visible ones are
+ // dirty (and thus repaint needed)
+ bool updateTileDirtiness(const SkIRect& tileBounds);
// check to see if the page is ready for display