// TODO: dynamically determine based on DPI
#define PREFETCH_SCALE_MODIFIER 0.3
#define PREFETCH_OPACITY 1
-#define PREFETCH_X_DIST 1
-#define PREFETCH_Y_DIST 2
+#define PREFETCH_X_DIST 0
+#define PREFETCH_Y_DIST 1
namespace WebCore {
void TiledPage::prepareRow(bool goingLeft, int tilesInRow, int firstTileX, int y, const SkIRect& tileBounds)
{
- if (y < 0)
- return;
-
for (int i = 0; i < tilesInRow; i++) {
int x = firstTileX;
else
x += i;
- if (x < 0)
- continue;
-
BaseTile* currentTile = 0;
BaseTile* availableTile = 0;
for (int j = 0; j < m_baseTileSize; j++) {
nbTilesHeight += expandY * 2;
}
+ // crop the prepared region to the contents of the base layer
+ float maxWidthTiles = m_glWebViewState->baseContentWidth() * m_scale / TilesManager::tileWidth();
+ float maxHeightTiles = m_glWebViewState->baseContentHeight() * m_scale / TilesManager::tileHeight();
+ firstTileX = std::max(0, firstTileX);
+ firstTileY = std::max(0, firstTileY);
+ lastTileX = std::min(lastTileX, static_cast<int>(ceilf(maxWidthTiles)) - 1);
+ lastTileY = std::min(lastTileY, static_cast<int>(ceilf(maxHeightTiles)) - 1);
+
m_expandedTileBounds.fLeft = firstTileX;
m_expandedTileBounds.fTop = firstTileY;
m_expandedTileBounds.fRight = lastTileX;