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

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 476833004: Refactor GrLayerCache for new API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add DISABLE_CACHING guard Created 6 years, 4 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/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index e459a116dfc975b98ff94dbd2024111ac8d305dc..df1ac4bdb73560e4f8fb1e04dddced2d92bfd767 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1989,7 +1989,7 @@ bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture
if (pullForward[i]) {
const GPUAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(i);
- GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(picture,
+ GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(picture->uniqueID(),
info.fSaveLayerOpID,
info.fRestoreOpID,
info.fCTM);
@@ -2007,7 +2007,8 @@ bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture
desc.fConfig = kSkia8888_GrPixelConfig;
// TODO: need to deal with sample count
- bool needsRendering = !fContext->getLayerCache()->lock(layer, desc);
+ bool needsRendering = fContext->getLayerCache()->lock(layer, desc,
+ info.fHasNestedLayers || info.fIsNested);
if (NULL == layer->texture()) {
continue;
}
@@ -2126,13 +2127,22 @@ bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture
for (int i = 0; i < gpuData->numSaveLayers(); ++i) {
const GPUAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(i);
- GrCachedLayer* layer = fContext->getLayerCache()->findLayer(picture,
+ GrCachedLayer* layer = fContext->getLayerCache()->findLayer(picture->uniqueID(),
info.fSaveLayerOpID,
info.fRestoreOpID,
info.fCTM);
fContext->getLayerCache()->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
+ fContext->getLayerCache()->purge(picture->uniqueID());
+
+ fContext->getLayerCache()->purgeAll();
+#endif
+
return true;
}
« 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