When a bitmap is texture-backed, change SkBitmap::copyTo() to do a deep
copy of the texels in VRAM rather than a readback and re-upload.  This
gives a 3-10X speedup on recursive canvas-to-canvas draws.

N.B.:  This introduces a new GM test, which will need new baselines.



git-svn-id: http://skia.googlecode.com/svn/trunk@2790 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 70c9f6d..e4b1150 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -1813,6 +1813,27 @@
                             config, buffer, rowBytes, flipY);
 }
 
+void GrContext::copyTexture(GrTexture* src, GrRenderTarget* dst) {
+    if (NULL == src || NULL == dst) {
+        return;
+    }
+    ASSERT_OWNED_RESOURCE(src);
+
+    GrDrawTarget::AutoStateRestore asr(fGpu);
+    reset_target_state(fGpu);
+    fGpu->setRenderTarget(dst);
+    GrSamplerState sampler(GrSamplerState::kClamp_WrapMode, 
+                           GrSamplerState::kClamp_WrapMode,
+                           GrSamplerState::kNearest_Filter);
+    GrMatrix sampleM;
+    sampleM.setIDiv(src->width(), src->height());
+    sampler.setMatrix(sampleM);
+    fGpu->setTexture(0, src);
+    fGpu->setSamplerState(0, sampler);
+    SkRect rect = SkRect::MakeXYWH(0, 0, src->width(), src->height());
+    fGpu->drawSimpleRect(rect, NULL, 1 << 0);
+}
+
 void GrContext::internalWriteRenderTargetPixels(GrRenderTarget* target, 
                                                 int left, int top,
                                                 int width, int height,