Index: include/gpu/GrContext.h |
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h |
index e1af73ccb2497c9cbea64b248aa5b9b6bf5c1c2f..3256e886b09659b22eab5d31e4adc82990cfb1f2 100644 |
--- a/include/gpu/GrContext.h |
+++ b/include/gpu/GrContext.h |
@@ -295,12 +295,6 @@ public: |
GrTexture* lockAndRefScratchTexture(const GrTextureDesc&, ScratchTexMatch match); |
/** |
- * When done with an entry, call unlockScratchTexture(entry) on it, which returns |
- * it to the cache, where it may be purged. This does not unref the texture. |
- */ |
- void unlockScratchTexture(GrTexture* texture); |
- |
- /** |
* Creates a texture that is outside the cache. Does not count against |
* cache's budget. |
*/ |
@@ -1051,15 +1045,7 @@ private: |
size_t rowBytes, |
bool filter); |
- // Needed so GrTexture's returnToCache helper function can call |
- // addExistingTextureToCache |
- friend class GrTexture; |
- friend class GrStencilAndCoverPathRenderer; |
- friend class GrStencilAndCoverTextContext; |
- |
- // Add an existing texture to the texture cache. This is intended solely |
- // for use with textures released from an GrAutoScratchTexture. |
- void addExistingTextureToCache(GrTexture* texture); |
+ bool addNewScratchTexture(const GrTextureDesc& desc); |
/** |
* These functions create premul <-> unpremul effects if it is possible to generate a pair |
@@ -1079,8 +1065,7 @@ private: |
}; |
/** |
- * Gets and locks a scratch texture from a descriptor using either exact or approximate criteria. |
- * Unlocks texture in the destructor. |
+ * This is deprecated. Don't use it. |
*/ |
class GrAutoScratchTexture : public ::SkNoncopyable { |
public: |
@@ -1103,25 +1088,16 @@ public: |
void reset() { |
if (fContext && fTexture) { |
- fContext->unlockScratchTexture(fTexture); |
fTexture->unref(); |
fTexture = NULL; |
} |
} |
- /* |
- * When detaching a texture we do not unlock it in the texture cache but |
- * we do set the returnToCache flag. In this way the texture remains |
- * "locked" in the texture cache until it is freed and recycled in |
- * GrTexture::internal_dispose. In reality, the texture has been removed |
- * from the cache (because this is in AutoScratchTexture) and by not |
- * calling unlockScratchTexture we simply don't re-add it. It will be |
- * reattached in GrTexture::internal_dispose. |
- * |
- * Note that the caller is assumed to accept and manage the ref to the |
- * returned texture. |
- */ |
- GrTexture* detach(); |
+ GrTexture* detach() { |
+ GrTexture* texture = fTexture; |
+ fTexture = NULL; |
+ return texture; |
+ } |
GrTexture* set(GrContext* context, |
const GrTextureDesc& desc, |