Make GrTextureCache into a generic GrResource cache. Also some GrContext texture interface cleanup.

http://codereview.appspot.com/4815055/


git-svn-id: http://skia.googlecode.com/svn/trunk@1965 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h
index bddf24e..b4ab185 100644
--- a/include/gpu/SkGpuDevice.h
+++ b/include/gpu/SkGpuDevice.h
@@ -22,6 +22,7 @@
 #include "SkBitmap.h"
 #include "SkDevice.h"
 #include "SkRegion.h"
+#include "GrContext.h"
 
 struct SkDrawProcs;
 struct GrSkDrawProcs;
@@ -126,18 +127,16 @@
     virtual void makeRenderTargetCurrent();
 
 protected:
-
-    class TexCache;
+    typedef GrContext::TextureCacheEntry TexCache;
     enum TexType {
         kBitmap_TexType,
         kDeviceRenderTarget_TexType,
         kSaveLayerDeviceRenderTarget_TexType
     };
-    TexCache* lockCachedTexture(const SkBitmap& bitmap,
-                                const GrSamplerState& sampler,
-                                GrTexture** texture,
-                                TexType type = kBitmap_TexType);
-    void unlockCachedTexture(TexCache*);
+    TexCache lockCachedTexture(const SkBitmap& bitmap,
+                               const GrSamplerState& sampler,
+                               TexType type = kBitmap_TexType);
+    void unlockCachedTexture(TexCache);
 
     class SkAutoCachedTexture {
     public:
@@ -152,7 +151,7 @@
 
     private:
         SkGpuDevice*    fDevice;
-        TexCache*       fTex;
+        TexCache        fTex;
     };
     friend class SkAutoTexCache;
 
@@ -162,11 +161,11 @@
     GrSkDrawProcs*  fDrawProcs;
 
     // state for our offscreen render-target
-    TexCache*       fCache;
-    GrTexture*      fTexture;
-    GrRenderTarget* fRenderTarget;
-    bool            fNeedClear;
-    bool            fNeedPrepareRenderTarget;
+    TexCache            fCache;
+    GrTexture*          fTexture;
+    GrRenderTarget*     fRenderTarget;
+    bool                fNeedClear;
+    bool                fNeedPrepareRenderTarget;
 
     // called from rt and tex cons
     void initFromRenderTarget(GrContext*, GrRenderTarget*);