Adding public API method on SkImage for extracting the GPU texture handle.

TEST=Surface unit test

Review URL: https://codereview.chromium.org/14646007

git-svn-id: http://skia.googlecode.com/svn/trunk@8945 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index b388d58..788d06b 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -31,3 +31,8 @@
                    const SkPaint* paint) {
     asIB(this)->onDraw(canvas, x, y, paint);
 }
+
+GrTexture* SkImage::getTexture() {
+    return asIB(this)->onGetTexture();
+}
+
diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h
index 2687025..d8e64a9 100644
--- a/src/image/SkImage_Base.h
+++ b/src/image/SkImage_Base.h
@@ -15,6 +15,7 @@
     SkImage_Base(int width, int height) : INHERITED(width, height) {}
 
     virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) = 0;
+    virtual GrTexture* onGetTexture() { return NULL; }
 
 private:
     typedef SkImage INHERITED;
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index f531a77..451ad07 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -21,6 +21,7 @@
     virtual ~SkImage_Gpu();
 
     virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) SK_OVERRIDE;
+    virtual GrTexture* onGetTexture() SK_OVERRIDE;
 
     GrTexture* getTexture() { return fTexture; }
 
@@ -56,6 +57,10 @@
     canvas->drawBitmap(fBitmap, x, y, paint);
 }
 
+GrTexture* SkImage_Gpu::onGetTexture() {
+    return fTexture;
+}
+
 void SkImage_Gpu::setTexture(GrTexture* texture) {
 
     if (texture == fTexture) {