Make GM render to render targets that are also textures.
Review URL: https://codereview.chromium.org/13211002
git-svn-id: http://skia.googlecode.com/svn/trunk@8438 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h
index a6087c8..8aa7d4a 100644
--- a/include/gpu/SkGpuDevice.h
+++ b/include/gpu/SkGpuDevice.h
@@ -27,16 +27,24 @@
*/
class SK_API SkGpuDevice : public SkDevice {
public:
+
+ /**
+ * Creates an SkGpuDevice from a GrSurface. This will fail if the surface is not a render
+ * target. The caller owns a ref on the returned device.
+ */
+ static SkGpuDevice* Create(GrSurface* surface);
+
/**
* New device that will create an offscreen renderTarget based on the
* config, width, height, and sampleCount. The device's storage will not
* count against the GrContext's texture cache budget. The device's pixels
- * will be uninitialized.
+ * will be uninitialized. TODO: This can fail, replace with a factory function.
*/
SkGpuDevice(GrContext*, SkBitmap::Config, int width, int height, int sampleCount = 0);
/**
* New device that will render to the specified renderTarget.
+ * DEPRECATED: Use Create(surface)
*/
SkGpuDevice(GrContext*, GrRenderTarget*);
@@ -44,6 +52,7 @@
* New device that will render to the texture (as a rendertarget).
* The GrTexture's asRenderTarget() must be non-NULL or device will not
* function.
+ * DEPRECATED: Use Create(surface)
*/
SkGpuDevice(GrContext*, GrTexture*);