Remove notion of default rendertarget. This doesn't map well to usage patterns outside sample app. Make binding between SkGpuDevice and a GrRenderTarget more explicit. Create method on GrContext to wrap the current target in the 3D API with a GrRenderTarget.



git-svn-id: http://skia.googlecode.com/svn/trunk@706 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h
index 141ed96..9c612c5 100644
--- a/include/gpu/SkGpuDevice.h
+++ b/include/gpu/SkGpuDevice.h
@@ -32,7 +32,22 @@
  */
 class SkGpuDevice : public SkDevice {
 public:
-    SkGpuDevice(GrContext*, const SkBitmap& bitmap, bool isLayer);
+    /**
+     * The SkGpuDevice will render to the GrRenderTarget, or if the paremeter is
+     * null it will create its own render target and manage that target's
+     * lifetime.
+     */
+    SkGpuDevice(GrContext*,
+                const SkBitmap& bitmap,
+                GrRenderTarget* renderTargetOrNull);
+
+    /**
+     * Magic value that can be passed to constructor. Causes
+     * the device to infer rendertarget from underlying 3D API (e.g. GL or D3D).
+     * This isn't a valid pointer, don't attempt to dereference.
+     */
+    static GrRenderTarget* Current3DApiRenderTarget();
+
     virtual ~SkGpuDevice();
 
     GrContext* context() const { return fContext; }
@@ -46,14 +61,6 @@
      */
     intptr_t getLayerTextureHandle() const;
 
-    /**
-     * Attaches the device to a rendering surface. This device will then render
-     * to the surface.
-     * For example, in OpenGL, the device will interpret handle as an FBO ID
-     * and drawing to the device would direct GL to the FBO.
-     */
-    void bindDeviceToTargetHandle(intptr_t handle);
-
     // call to set the clip to the specified rect
     void scissor(const SkIRect&);