Add APIs and plumbing for external rendertaret-textures w/ and w/out MSAA.

Review URL: http://codereview.appspot.com/4388049/



git-svn-id: http://skia.googlecode.com/svn/trunk@1102 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 2d50c36..4d3aa3a 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1453,12 +1453,27 @@
         rootRenderTarget->ref();
     }
     context->ref();
+    fRootTexture = NULL;
+}
 
+SkGpuDeviceFactory::SkGpuDeviceFactory(GrContext* context, GrTexture* rootRenderTargetTexture) {
+    GrAssert(NULL != context);
+    GrAssert(NULL != rootRenderTargetTexture);
+    GrAssert(NULL != rootRenderTargetTexture->asRenderTarget());
+
+    fRootTexture = rootRenderTargetTexture;
+    rootRenderTargetTexture->ref();
+
+    fRootRenderTarget = rootRenderTargetTexture->asRenderTarget();
+    fRootRenderTarget->ref();
+
+    context->ref();
 }
 
 SkGpuDeviceFactory::~SkGpuDeviceFactory() {
     fContext->unref();
     fRootRenderTarget->unref();
+    GrSafeUnref(fRootTexture);
 }
 
 SkDevice* SkGpuDeviceFactory::newDevice(SkCanvas*, SkBitmap::Config config,