summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2011-09-09 11:04:00 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-09-09 11:04:00 -0700
commitc622298990df11240ed11cd66c8bc7671a8ec59a (patch)
treef1c9193924042d050544828aca326d11d199e5cd /Source
parentc32430605169445a9e3e1271ebab51be8c3b25f0 (diff)
parente733717c7b60d2ccfee9c47af4659ffb8e70dd73 (diff)
downloadexternal_webkit-c622298990df11240ed11cd66c8bc7671a8ec59a.zip
external_webkit-c622298990df11240ed11cd66c8bc7671a8ec59a.tar.gz
external_webkit-c622298990df11240ed11cd66c8bc7671a8ec59a.tar.bz2
Merge "If unlock base layer marks tiles dirty, repaint"
Diffstat (limited to 'Source')
-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