diff options
-rw-r--r-- | src/gpu/GrLayerCache.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gpu/GrLayerCache.cpp b/src/gpu/GrLayerCache.cpp index f60b6a8120..d4f8b70b39 100644 --- a/src/gpu/GrLayerCache.cpp +++ b/src/gpu/GrLayerCache.cpp @@ -94,6 +94,8 @@ GrLayerCache::~GrLayerCache() { SkDELETE(layer); } + SkASSERT(0 == fPictureHash.count()); + // The atlas only lets go of its texture when the atlas is deleted. fAtlas.free(); } @@ -273,6 +275,11 @@ void GrLayerCache::unlock(GrCachedLayer* layer) { if (0 == pictInfo->plotUsage(plotID)) { GrAtlas::RemovePlot(&pictInfo->fPlotUsage, layer->plot()); + + if (pictInfo->fPlotUsage.isEmpty()) { + fPictureHash.remove(pictInfo->fPictureID); + SkDELETE(pictInfo); + } } layer->setPlot(NULL); @@ -442,6 +449,8 @@ void GrLayerCache::purgeAll() { this->purgePlot(plot); } + SkASSERT(0 == fPictureHash.count()); + fContext->discardRenderTarget(fAtlas->getTexture()->asRenderTarget()); } #endif |