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

Unified Diff: src/gpu/GrContext.cpp

Issue 261593009: Allow custom resources in the GrContext's cache (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebaes Created 6 years, 7 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 | « include/gpu/GrContext.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index c518a1c8ac0438456f692ff02fd4b35e64bddfd8..d2664c3b86524b018642e0f8b41bd012b5d8628c 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -1825,6 +1825,17 @@ GrPath* GrContext::createPath(const SkPath& inPath, const SkStrokeRec& stroke) {
return path;
}
+void GrContext::addResourceToCache(const GrResourceKey& resourceKey, GrCacheable* resource) {
+ fTextureCache->purgeAsNeeded(1, resource->gpuMemorySize());
+ fTextureCache->addResource(resourceKey, resource);
+}
+
+GrCacheable* GrContext::findAndRefCachedResource(const GrResourceKey& resourceKey) {
+ GrCacheable* resource = fTextureCache->find(resourceKey);
+ SkSafeRef(resource);
+ return resource;
+}
+
///////////////////////////////////////////////////////////////////////////////
#if GR_CACHE_STATS
void GrContext::printCacheStats() const {
« no previous file with comments | « include/gpu/GrContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698