diff options
author | Nicolas Roard <nicolasroard@google.com> | 2011-03-23 18:00:45 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-03-23 18:00:45 -0700 |
commit | da37bf0f7c9b233de04bf197dc4d3404e88b8bab (patch) | |
tree | ea5f039d9a3b3cff0189c1984e7fa491b1c635e9 /WebCore/platform/graphics/android/TiledPage.cpp | |
parent | 9c3a8828b97457faefa3936b1f2e37d4a2ce5b53 (diff) | |
parent | 284cf17e2bcea995294e7ecdca145593523c3edc (diff) | |
download | external_webkit-da37bf0f7c9b233de04bf197dc4d3404e88b8bab.zip external_webkit-da37bf0f7c9b233de04bf197dc4d3404e88b8bab.tar.gz external_webkit-da37bf0f7c9b233de04bf197dc4d3404e88b8bab.tar.bz2 |
am 284cf17e: am 909e9c7e: Improve performances for the base surface rendering
* commit '284cf17e2bcea995294e7ecdca145593523c3edc':
Improve performances for the base surface rendering
Diffstat (limited to 'WebCore/platform/graphics/android/TiledPage.cpp')
-rw-r--r-- | WebCore/platform/graphics/android/TiledPage.cpp | 49 |
1 files changed, 26 insertions, 23 deletions
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) |