Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: src/gpu/GrLayerHoister.cpp

Issue 640323002: Fix bug in GrCachedLayer reuse (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Improve comment Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrLayerCache.cpp ('k') | tests/GpuLayerCacheTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrLayerHoister.cpp
diff --git a/src/gpu/GrLayerHoister.cpp b/src/gpu/GrLayerHoister.cpp
index 00e8b99f459f608fb59999c001e126dd56a63741..e9e3a3f710afcd6e4c4fa77d965d40f2e402901b 100644
--- a/src/gpu/GrLayerHoister.cpp
+++ b/src/gpu/GrLayerHoister.cpp
@@ -54,6 +54,7 @@ static void prepare_for_hoisting(GrLayerCache* layerCache,
hl = recycled->append();
}
+ layerCache->addUse(layer);
hl->fLayer = layer;
hl->fPicture = pict;
hl->fOffset = info.fOffset;
@@ -263,19 +264,6 @@ void GrLayerHoister::DrawLayers(const SkTDArray<GrHoistedLayer>& atlased,
convert_layers_to_replacements(recycled, replacements);
}
-static void unlock_layer_in_cache(GrLayerCache* layerCache,
- const SkPicture* picture,
- GrCachedLayer* layer) {
- layerCache->unlock(layer);
-
-#if DISABLE_CACHING
- // This code completely clears out the atlas. It is required when
- // caching is disabled so the atlas doesn't fill up and force more
- // free floating layers
- layerCache->purge(picture->uniqueID());
-#endif
-}
-
void GrLayerHoister::UnlockLayers(GrContext* context,
const SkTDArray<GrHoistedLayer>& atlased,
const SkTDArray<GrHoistedLayer>& nonAtlased,
@@ -283,15 +271,15 @@ void GrLayerHoister::UnlockLayers(GrContext* context,
GrLayerCache* layerCache = context->getLayerCache();
for (int i = 0; i < atlased.count(); ++i) {
- unlock_layer_in_cache(layerCache, atlased[i].fPicture, atlased[i].fLayer);
+ layerCache->removeUse(atlased[i].fLayer);
}
for (int i = 0; i < nonAtlased.count(); ++i) {
- unlock_layer_in_cache(layerCache, nonAtlased[i].fPicture, nonAtlased[i].fLayer);
+ layerCache->removeUse(nonAtlased[i].fLayer);
}
for (int i = 0; i < recycled.count(); ++i) {
- unlock_layer_in_cache(layerCache, recycled[i].fPicture, recycled[i].fLayer);
+ layerCache->removeUse(recycled[i].fLayer);
}
#if DISABLE_CACHING
@@ -300,5 +288,7 @@ void GrLayerHoister::UnlockLayers(GrContext* context,
// free floating layers
layerCache->purgeAll();
#endif
+
+ SkDEBUGCODE(layerCache->validate();)
}
« no previous file with comments | « src/gpu/GrLayerCache.cpp ('k') | tests/GpuLayerCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698