Adds read pixels to GrTexture and GrRenderTarget
Adds SkGrRenderTargetPixelRef for SkBitmaps that are backed by RTs that aren't textures.
Adds onReadPixels implementations for SkGr pixel ref types



git-svn-id: http://skia.googlecode.com/svn/trunk@1056 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/SkGr.h b/include/gpu/SkGr.h
index 49dac74..10f1bd0 100644
--- a/include/gpu/SkGr.h
+++ b/include/gpu/SkGr.h
@@ -129,10 +129,10 @@
      *  Convert the SkBitmap::Config to the corresponding PixelConfig, or
      *  kUnknown_PixelConfig if the conversion cannot be done.
      */
-    static GrTexture::PixelConfig BitmapConfig2PixelConfig(SkBitmap::Config,
-                                                        bool isOpaque);
+    static GrPixelConfig BitmapConfig2PixelConfig(SkBitmap::Config,
+                                                  bool isOpaque);
 
-    static GrTexture::PixelConfig Bitmap2PixelConfig(const SkBitmap& bm) {
+    static GrPixelConfig Bitmap2PixelConfig(const SkBitmap& bm) {
         return BitmapConfig2PixelConfig(bm.config(), bm.isOpaque());
     }
 
diff --git a/include/gpu/SkGrTexturePixelRef.h b/include/gpu/SkGrTexturePixelRef.h
index a423251..5bc64f5 100644
--- a/include/gpu/SkGrTexturePixelRef.h
+++ b/include/gpu/SkGrTexturePixelRef.h
@@ -47,5 +47,31 @@
     typedef SkPixelRef INHERITED;
 };
 
+class SkGrRenderTargetPixelRef : public SkPixelRef {
+public:
+            SkGrRenderTargetPixelRef(GrRenderTarget* rt);
+    virtual ~SkGrRenderTargetPixelRef();
+
+    // override from SkPixelRef
+    virtual SkGpuTexture* getTexture();
+
+protected:
+    // override from SkPixelRef
+    virtual void* onLockPixels(SkColorTable** ptr) {
+        if (ptr) {
+            *ptr = NULL;
+        }
+        return NULL;
+    }
+
+    // override from SkPixelRef
+    virtual void onUnlockPixels() {}
+    virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subset);
+
+private:
+    GrRenderTarget*  fRenderTarget;
+    typedef SkPixelRef INHERITED;
+};
+
 #endif