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/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