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

Unified Diff: src/gpu/GrContext.cpp

Issue 26557003: Add a GPU paths to resource cache of the context (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 1 month 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') | src/gpu/GrPath.h » ('j') | 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 cf3b86af5315250a4696b970617d5d38435c23ea..16ccc8a938e9e74d33ac9935968947b441ad1145 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -217,6 +217,7 @@ void GrContext::contextDestroyed() {
fOvalRenderer->reset();
fTextureCache->purgeAllUnlocked();
+
fFontCache->freeAll();
fGpu->markContextDirty();
}
@@ -1812,6 +1813,22 @@ const GrEffectRef* GrContext::createUPMToPMEffect(GrTexture* texture,
}
}
+GrPath* GrContext::createPath(const SkPath& inPath, const SkStrokeRec& stroke) {
+ SkASSERT(fGpu->caps()->pathRenderingSupport());
+
+ // TODO: now we add to fTextureCache. This should change to fResourceCache.
+ GrResourceKey resourceKey = GrPath::ComputeKey(inPath, stroke);
+ GrPath* path = static_cast<GrPath*>(fTextureCache->find(resourceKey));
+ if (NULL != path && path->isEqualTo(inPath, stroke)) {
+ path->ref();
+ } else {
+ path = fGpu->createPath(inPath, stroke);
+ fTextureCache->purgeAsNeeded(1, path->sizeInBytes());
+ fTextureCache->addResource(resourceKey, path);
+ }
+ return path;
+}
+
///////////////////////////////////////////////////////////////////////////////
#if GR_CACHE_STATS
void GrContext::printCacheStats() const {
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/gpu/GrPath.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698