Replaced TextureCacheEntry with GrTexture* and a back pointer to GrResourceEntry (in GrTexture)
http://codereview.appspot.com/6460089/
git-svn-id: http://skia.googlecode.com/svn/trunk@5122 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrResource.h b/include/gpu/GrResource.h
index 94d2173..0f4b03d 100644
--- a/include/gpu/GrResource.h
+++ b/include/gpu/GrResource.h
@@ -14,6 +14,7 @@
class GrGpu;
class GrContext;
+class GrResourceEntry;
/**
* Base class for the GPU resources created by a GrContext.
@@ -52,7 +53,7 @@
*
* @return the size of the buffer in bytes
*/
- virtual size_t sizeInBytes() const = 0;
+ virtual size_t sizeInBytes() const = 0;
/**
* Retrieves the context that owns the resource. Note that it is possible
@@ -60,8 +61,11 @@
* abandon()ed they no longer have an owning context. Destroying a
* GrContext automatically releases all its resources.
*/
- const GrContext* getContext() const;
- GrContext* getContext();
+ const GrContext* getContext() const;
+ GrContext* getContext();
+
+ void setCacheEntry(GrResourceEntry* cacheEntry) { fCacheEntry = cacheEntry; }
+ GrResourceEntry* getCacheEntry() { return fCacheEntry; }
protected:
explicit GrResource(GrGpu* gpu);
@@ -83,6 +87,8 @@
GrResource* fNext; // dl-list of resources per-GrGpu
GrResource* fPrevious;
+ GrResourceEntry* fCacheEntry; // NULL if not in cache
+
typedef GrRefCnt INHERITED;
};