summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
diff options
context:
space:
mode:
authorNicolas Roard <nicolas@android.com>2011-01-23 15:01:19 -0800
committerNicolas Roard <nicolas@android.com>2011-01-23 15:22:37 -0800
commit245e0cdd9ea80915059080a2bedbb9ebb5cc646c (patch)
tree54c5301592a888869aa712582d00da3bfb476336 /WebCore/platform/graphics/android/BaseLayerAndroid.cpp
parentf0425628b4e83bf9e1c8275d809d433baeaf768c (diff)
downloadexternal_webkit-245e0cdd9ea80915059080a2bedbb9ebb5cc646c.zip
external_webkit-245e0cdd9ea80915059080a2bedbb9ebb5cc646c.tar.gz
external_webkit-245e0cdd9ea80915059080a2bedbb9ebb5cc646c.tar.bz2
Implement tiles synchronization
When a tiledPage is painted, we want to avoid updating the base layer. GLWebViewState and WebView.cpp are now refcounting the base layer, delaying updating the base layer we use to paint until we are done with a full tile paint. bug:3224744 Change-Id: Ica2b8f1db146a1e059fc0735dc53107fc40da07a
Diffstat (limited to 'WebCore/platform/graphics/android/BaseLayerAndroid.cpp')
-rw-r--r--WebCore/platform/graphics/android/BaseLayerAndroid.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
index 1e7e209..57a53ab 100644
--- a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
@@ -174,6 +174,10 @@ bool BaseLayerAndroid::drawBasePictureInGL(SkRect& viewport, float scale)
nextTiledPage->prepare(goingDown, goingLeft, viewportTileBounds);
}
+ bool zooming = false;
+ if (m_glWebViewState->scaleRequestState() != GLWebViewState::kNoScaleRequest)
+ zooming = true;
+
float transparency = 1;
bool doSwap = false;
@@ -209,8 +213,30 @@ bool BaseLayerAndroid::drawBasePictureInGL(SkRect& viewport, float scale)
TiledPage* tiledPage = m_glWebViewState->frontPage();
tiledPage->setScale(m_glWebViewState->currentScale());
const SkIRect& preZoomBounds = m_glWebViewState->preZoomBounds();
- tiledPage->prepare(goingDown, goingLeft, preZoomBounds);
- tiledPage->draw(transparency, preZoomBounds);
+
+ TiledPage* nextTiledPage = m_glWebViewState->backPage();
+
+ // We are now using an hybrid model -- during zooming or scrolling,
+ // we will display the current tiledPage even if some tiles are
+ // out of date. When standing still on the other hand, we wait until
+ // the back page is ready before swapping the pages, ensuring that the
+ // displayed content is in sync.
+ if (!zooming && !m_glWebViewState->moving()) {
+ if (!tiledPage->ready(preZoomBounds)) {
+ nextTiledPage->setScale(m_glWebViewState->currentScale());
+ nextTiledPage->prepare(goingDown, goingLeft, preZoomBounds);
+ }
+ if (nextTiledPage->ready(preZoomBounds)) {
+ nextTiledPage->draw(transparency, preZoomBounds);
+ doSwap = true;
+ } else {
+ tiledPage->draw(transparency, preZoomBounds);
+ }
+ } else {
+ // Ask for the tiles and draw -- tiles may be out of date.
+ tiledPage->prepare(goingDown, goingLeft, preZoomBounds);
+ tiledPage->draw(transparency, preZoomBounds);
+ }
bool ret = false;
if (m_glWebViewState->scaleRequestState() != GLWebViewState::kNoScaleRequest