diff options
Diffstat (limited to 'WebCore')
-rw-r--r-- | WebCore/platform/graphics/android/BaseLayerAndroid.cpp | 4 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/TiledPage.cpp | 49 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/TiledPage.h | 3 |
3 files changed, 30 insertions, 26 deletions
diff --git a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp index 7a08e94..1786d64 100644 --- a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp +++ b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp @@ -169,7 +169,7 @@ bool BaseLayerAndroid::drawBasePictureInGL(SkRect& viewport, float scale, double nextTiledPage->setScale(scale); m_glWebViewState->setFutureViewport(viewportTileBounds); m_glWebViewState->lockBaseLayerUpdate(); - nextTiledPage->prepare(goingDown, goingLeft, viewportTileBounds); + nextTiledPage->prepare(goingDown, goingLeft, viewportTileBounds, true); } float transparency = 1; @@ -240,7 +240,7 @@ bool BaseLayerAndroid::drawBasePictureInGL(SkRect& viewport, float scale, double if (!zooming) m_glWebViewState->unlockBaseLayerUpdate(); - tiledPage->prepare(goingDown, goingLeft, preZoomBounds); + tiledPage->prepare(goingDown, goingLeft, preZoomBounds, true); tiledPage->draw(transparency, preZoomBounds); } diff --git a/WebCore/platform/graphics/android/TiledPage.cpp b/WebCore/platform/graphics/android/TiledPage.cpp index 4fa3e0e..099ed4d 100644 --- a/WebCore/platform/graphics/android/TiledPage.cpp +++ b/WebCore/platform/graphics/android/TiledPage.cpp @@ -234,7 +234,8 @@ void TiledPage::updateTileState(const SkIRect& tileBounds) m_invalTilesRegion.setEmpty(); } -void TiledPage::prepare(bool goingDown, bool goingLeft, const SkIRect& tileBounds) +void TiledPage::prepare(bool goingDown, bool goingLeft, const SkIRect& tileBounds, + bool scheduleFirst) { if (!m_glWebViewState) return; @@ -254,23 +255,25 @@ void TiledPage::prepare(bool goingDown, bool goingLeft, const SkIRect& tileBound const int baseContentHeight = m_glWebViewState->baseContentHeight(); const int baseContentWidth = m_glWebViewState->baseContentWidth(); - TileSet* highResSet = new TileSet(this, nbTilesHeight, nbTilesWidth); - - // Expand number of tiles to allow tiles outside of viewport to be prepared for - // smoother scrolling. - int nTilesToPrepare = nbTilesWidth * nbTilesHeight; - int nMaxTilesPerPage = m_baseTileSize / 2; - int expandX = TilesManager::instance()->expandedTileBoundsX(); - int expandY = TilesManager::instance()->expandedTileBoundsY(); - if (nTilesToPrepare + (nbTilesHeight * expandX * 2) <= nMaxTilesPerPage) { - firstTileX -= expandX; - lastTileX += expandX; - nbTilesWidth += expandX * 2; - } - if (nTilesToPrepare + (nbTilesWidth * expandY * 2) <= nMaxTilesPerPage) { - firstTileY -= expandY; - lastTileY += expandY; - nbTilesHeight += expandY * 2; + TileSet* set = new TileSet(this, nbTilesHeight, nbTilesWidth); + + if (!scheduleFirst) { + // Expand number of tiles to allow tiles outside of viewport to be prepared for + // smoother scrolling. + int nTilesToPrepare = nbTilesWidth * nbTilesHeight; + int nMaxTilesPerPage = m_baseTileSize / 2; + int expandX = TilesManager::instance()->expandedTileBoundsX(); + int expandY = TilesManager::instance()->expandedTileBoundsY(); + if (nTilesToPrepare + (nbTilesHeight * expandX * 2) <= nMaxTilesPerPage) { + firstTileX -= expandX; + lastTileX += expandX; + nbTilesWidth += expandX * 2; + } + if (nTilesToPrepare + (nbTilesWidth * expandY * 2) <= nMaxTilesPerPage) { + firstTileY -= expandY; + lastTileY += expandY; + nbTilesHeight += expandY * 2; + } } // We chose to prepare tiles depending on the scroll direction. Tiles are @@ -279,16 +282,16 @@ void TiledPage::prepare(bool goingDown, bool goingLeft, const SkIRect& tileBound // to the are processed first. if (goingDown) { for (int i = 0; i < nbTilesHeight; i++) - prepareRow(goingLeft, nbTilesWidth, firstTileX, lastTileY - i, highResSet); + prepareRow(goingLeft, nbTilesWidth, firstTileX, lastTileY - i, set); } else { for (int i = 0; i < nbTilesHeight; i++) - prepareRow(goingLeft, nbTilesWidth, firstTileX, firstTileY + i, highResSet); + prepareRow(goingLeft, nbTilesWidth, firstTileX, firstTileY + i, set); } // The paint operation will take ownership of the tileSet here, so no delete // is necessary. - PaintTileSetOperation* operation = new PaintTileSetOperation(highResSet); - TilesManager::instance()->scheduleOperation(operation); + PaintTileSetOperation* operation = new PaintTileSetOperation(set); + TilesManager::instance()->scheduleOperation(operation, scheduleFirst); } bool TiledPage::ready(const SkIRect& tileBounds, float scale) @@ -296,7 +299,7 @@ bool TiledPage::ready(const SkIRect& tileBounds, float scale) if (!m_glWebViewState) return false; - if (!m_invalRegion.isEmpty() && !m_prepare) + if (!m_prepare) return false; if (m_scale != scale) diff --git a/WebCore/platform/graphics/android/TiledPage.h b/WebCore/platform/graphics/android/TiledPage.h index 9eb9f11..7e0bb2e 100644 --- a/WebCore/platform/graphics/android/TiledPage.h +++ b/WebCore/platform/graphics/android/TiledPage.h @@ -57,7 +57,8 @@ public: TiledPage* sibling(); // prepare the page for display on the screen - void prepare(bool goingDown, bool goingLeft, const SkIRect& tileBounds); + void prepare(bool goingDown, bool goingLeft, const SkIRect& tileBounds, + bool scheduleFirst = false); // check to see if the page is ready for display bool ready(const SkIRect& tileBounds, float scale); // draw the page on the screen |