Improve save layer handling in SkGpuDevice

http://codereview.appspot.com/5966048/



git-svn-id: http://skia.googlecode.com/svn/trunk@3563 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h
index 409e3b3..ffc24a8 100644
--- a/include/gpu/SkGpuDevice.h
+++ b/include/gpu/SkGpuDevice.h
@@ -29,14 +29,11 @@
 public:
     /**
      *  New device that will create an offscreen renderTarget based on the
-     *  config, width, height.
-     *
-     *  usage is a special flag that should only be set by SkCanvas
-     *  internally.
+     *  config, width, height. The device's storage will not count against
+     *  the GrContext's texture cache budget. The device's pixels will be
+     *  uninitialized.
      */
-    SkGpuDevice(GrContext*, SkBitmap::Config,
-                int width, int height,
-                SkDevice::Usage usage = SkDevice::kGeneral_Usage);
+    SkGpuDevice(GrContext*, SkBitmap::Config, int width, int height);
 
     /**
      *  New device that will render to the specified renderTarget.
@@ -118,14 +115,8 @@
 
 protected:
     typedef GrContext::TextureCacheEntry TexCache;
-    enum TexType {
-        kBitmap_TexType,
-        kDeviceRenderTarget_TexType,
-        kSaveLayerDeviceRenderTarget_TexType
-    };
     TexCache lockCachedTexture(const SkBitmap& bitmap,
-                               const GrSamplerState* sampler,
-                               TexType type = kBitmap_TexType);
+                               const GrSamplerState* sampler);
     bool isBitmapInTextureCache(const SkBitmap& bitmap,
                                 const GrSamplerState& sampler) const;
     void unlockCachedTexture(TexCache);
@@ -152,6 +143,9 @@
     // called from rt and tex cons
     void initFromRenderTarget(GrContext*, GrRenderTarget*);
 
+    // used by createCompatibleDevice
+    SkGpuDevice(GrContext*, GrTexture* texture, TexCache, bool needClear);
+
     // override from SkDevice
     virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config config,
                                                int width, int height,