Added find, lock to GrContext & GrResourceCache interfaces
https://codereview.appspot.com/6499052/
git-svn-id: http://skia.googlecode.com/svn/trunk@5343 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 13ada9a..6a4a557 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -207,6 +207,11 @@
}
+
+GrTexture* GrContext::findTexture(const GrCacheKey& key) {
+ return static_cast<GrTexture*>(fTextureCache->find(key.key()));
+}
+
GrTexture* GrContext::findAndLockTexture(const GrTextureDesc& desc,
const GrCacheData& cacheData,
const GrTextureParams* params) {
@@ -484,6 +489,17 @@
fTextureCache->unlock(texture->getCacheEntry());
}
+void GrContext::lockTexture(GrTexture* texture) {
+
+ if (NULL == texture->getCacheEntry()) {
+ // not in the cache
+ GrAssert(0);
+ return;
+ }
+
+ fTextureCache->lock(texture->getCacheEntry());
+}
+
void GrContext::unlockTexture(GrTexture* texture) {
ASSERT_OWNED_RESOURCE(texture);
GrAssert(NULL != texture->getCacheEntry());