diff options
author | Chris Craik <ccraik@google.com> | 2011-09-27 10:17:32 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2011-09-29 16:06:42 -0700 |
commit | f6a40880028cf495025747229c627f42e25acc66 (patch) | |
tree | 0bb9844b902cea7a2c70d4926972d51175727c1a /Source/WebCore/platform/graphics/android/TiledPage.cpp | |
parent | ebcd36bcdbefb452a0be4e9e452a054ffdff4763 (diff) | |
download | external_webkit-f6a40880028cf495025747229c627f42e25acc66.zip external_webkit-f6a40880028cf495025747229c627f42e25acc66.tar.gz external_webkit-f6a40880028cf495025747229c627f42e25acc66.tar.bz2 |
Use state machine to track tile state
bug:5369978
Manage invalidations, painting, transferring, and swapping with a
state machine.
notes:
* readyFor shouldn't be needed if all of the events that would cause a readyfor
fail mark the tile dirty (such as stealing, scale change)
* changing the scale of a page should discard all textures
* m_dirty should be more gracefully worked into the state machine
* a tile may drop dirtiness notifications if it's already painting, since upon
completion m_dirty will be cleared - (issues for layers only)
Change-Id: I5909fb5d208da2fb276e223c56bf143741a9a24c
Diffstat (limited to 'Source/WebCore/platform/graphics/android/TiledPage.cpp')
-rw-r--r-- | Source/WebCore/platform/graphics/android/TiledPage.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/Source/WebCore/platform/graphics/android/TiledPage.cpp b/Source/WebCore/platform/graphics/android/TiledPage.cpp index 0c7a2a8..34f0d4e 100644 --- a/Source/WebCore/platform/graphics/android/TiledPage.cpp +++ b/Source/WebCore/platform/graphics/android/TiledPage.cpp @@ -300,6 +300,7 @@ bool TiledPage::swapBuffersIfReady(const SkIRect& tileBounds, float scale, SwapM return false; int swaps = 0; + bool fullSwap = true; if (swap == SwapWholePage) { for (int x = tileBounds.fLeft; x < tileBounds.fRight; x++) { for (int y = tileBounds.fTop; y < tileBounds.fBottom; y++) { @@ -308,31 +309,26 @@ bool TiledPage::swapBuffersIfReady(const SkIRect& tileBounds, float scale, SwapM return false; } } - for (int x = tileBounds.fLeft; x < tileBounds.fRight; x++) { - for (int y = tileBounds.fTop; y < tileBounds.fBottom; y++) { - BaseTile* t = getBaseTile(x, y); - if (t->swapTexturesIfNeeded()) - swaps++; - } - } - XLOG("%p whole page swapped %d textures, returning true", this, swaps); - return true; } else { // SwapWhateveryIsReady - bool fullSwap = true; for (int x = tileBounds.fLeft; x < tileBounds.fRight; x++) { for (int y = tileBounds.fTop; y < tileBounds.fBottom; y++) { BaseTile* t = getBaseTile(x, y); if (!t || !t->isTileReady()) fullSwap = false; - else { - if (t->swapTexturesIfNeeded()) - swaps++; - } } } - XLOG("%p greedy swap swapped %d tiles, returning %d", this, swaps, fullSwap); - return fullSwap; } + + // swap every tile on page (even if off screen) + for (int j = 0; j < m_baseTileSize; j++) { + BaseTile& tile = m_baseTiles[j]; + if (tile.swapTexturesIfNeeded()) + swaps++; + } + + XLOG("%p %s swapped %d textures, returning true", + this, (swap == SwapWholePage) ? "whole page" : "greedy swap", swaps); + return fullSwap; } |