Index: src/gpu/GrContext.cpp |
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp |
index df26be6a462317c6cc4fc42119b66fc5df7b4716..091c4a899e401595fe26c4fa7f5053391d02e2cd 100755 |
--- a/src/gpu/GrContext.cpp |
+++ b/src/gpu/GrContext.cpp |
@@ -25,7 +25,6 @@ |
#include "GrPathRenderer.h" |
#include "GrPathUtils.h" |
#include "GrResourceCache.h" |
-#include "GrResourceCache2.h" |
#include "GrSoftwarePathRenderer.h" |
#include "GrStencilBuffer.h" |
#include "GrStencilAndCoverTextContext.h" |
@@ -109,7 +108,6 @@ |
fPathRendererChain = NULL; |
fSoftwarePathRenderer = NULL; |
fResourceCache = NULL; |
- fResourceCache2 = NULL; |
fFontCache = NULL; |
fDrawBuffer = NULL; |
fDrawBufferVBAllocPool = NULL; |
@@ -135,7 +133,6 @@ |
fResourceCache = SkNEW_ARGS(GrResourceCache, (MAX_RESOURCE_CACHE_COUNT, |
MAX_RESOURCE_CACHE_BYTES)); |
fResourceCache->setOverbudgetCallback(OverbudgetCB, this); |
- fResourceCache2 = SkNEW(GrResourceCache2); |
fFontCache = SkNEW_ARGS(GrFontCache, (fGpu)); |
@@ -164,8 +161,10 @@ |
(*fCleanUpData[i].fFunc)(this, fCleanUpData[i].fInfo); |
} |
- delete fResourceCache2; |
- fResourceCache2 = NULL; |
+ // Since the gpu can hold scratch textures, give it a chance to let go |
+ // of them before freeing the texture cache |
+ fGpu->purgeResources(); |
+ |
delete fResourceCache; |
fResourceCache = NULL; |
delete fFontCache; |
@@ -185,9 +184,7 @@ |
void GrContext::abandonContext() { |
// abandon first to so destructors |
// don't try to free the resources in the API. |
- fResourceCache2->abandonAll(); |
- |
- fGpu->contextAbandonded(); |
+ fGpu->abandonResources(); |
// a path renderer may be holding onto resources that |
// are now unusable |
@@ -210,6 +207,7 @@ |
fFontCache->freeAll(); |
fLayerCache->freeAll(); |
+ fGpu->markContextDirty(); |
} |
void GrContext::resetContext(uint32_t state) { |
@@ -220,9 +218,6 @@ |
this->flush(); |
fGpu->purgeResources(); |
- if (NULL != fDrawBuffer) { |
- fDrawBuffer->purgeResources(); |
- } |
fAARectRenderer->reset(); |
fOvalRenderer->reset(); |
@@ -545,10 +540,6 @@ |
} |
void GrContext::unlockScratchTexture(GrTexture* texture) { |
- if (texture->wasDestroyed()) { |
- return; |
- } |
- |
ASSERT_OWNED_RESOURCE(texture); |
SkASSERT(NULL != texture->getCacheEntry()); |