bug:
5349958
Clear a flag when a layer tile can't allocate a texture, and only try and redraw
from tile dirtiness if that flag is set.
Also, don't ask for redraw if offending tiles are offscreen.
Change-Id: Iadb0cb267a9c1f308e5b42a6e0e3b4bc71d18ece
TilesManager::instance()->videoLayerManager()->deleteUnusedTextures();
compositedRoot->prepare(m_glWebViewState);
- if (compositedRoot->drawGL(m_glWebViewState, matrix))
- needsRedraw = true;
- else if (!animsRunning)
+ if (compositedRoot->drawGL(m_glWebViewState, matrix)) {
+ if (TilesManager::instance()->layerTexturesRemain()) {
+ // only try redrawing for layers if layer textures remain,
+ // otherwise we'll repaint without getting anything done
+ needsRedraw = true;
+ }
+ } else if (!animsRunning)
m_glWebViewState->resetLayersDirtyArea();
}
for (unsigned int i = 0; i < m_tiles.size(); i++) {
BaseTile* tile = m_tiles[i];
- askRedraw |= !tile->isTileReady();
if (tile->isTileVisible(m_area)) {
+ askRedraw |= !tile->isTileReady();
SkRect rect;
rect.fLeft = tile->x() * tileWidth;
rect.fTop = tile->y() * tileHeight;
}
TilesManager::TilesManager()
- : m_layersMemoryUsage(0)
+ : m_layerTexturesRemain(true)
, m_maxTextureCount(0)
, m_generatorReady(false)
, m_showVisualIndicator(false)
{
android::Mutex::Autolock lock(m_texturesLock);
m_availableTilesTextures = m_tilesTextures;
+ m_layerTexturesRemain = true;
}
BaseTileTexture* TilesManager::getAvailableTexture(BaseTile* owner)
availableTexturePool->remove(availableTexturePool->find(farthestTexture));
return farthestTexture;
}
+ } else {
+ if (owner->isLayerTile()) {
+ // couldn't find a tile for a layer, layers shouldn't request redraw
+ // TODO: once we do layer prefetching, don't set this for those
+ // tiles
+ m_layerTexturesRemain = false;
+ }
}
XLOG("Couldn't find an available texture for %s tile %x (%d, %d) out of %d available",
void gatherLayerTextures();
void gatherTextures();
+ bool layerTexturesRemain() { return m_layerTexturesRemain; }
+
BaseTileTexture* getAvailableTexture(BaseTile* owner);
void markGeneratorAsReady()
Vector<BaseTileTexture*> m_tilesTextures;
Vector<BaseTileTexture*> m_availableTilesTextures;
+ bool m_layerTexturesRemain;
Vector<PaintedSurface*> m_paintedSurfaces;
- unsigned int m_layersMemoryUsage;
-
int m_maxTextureCount;
bool m_generatorReady;