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 { |