add abstract wrapper for platform-specific bitmap backends



git-svn-id: http://skia.googlecode.com/svn/trunk@596 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index 1c16b78..1f6f5a6 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -30,6 +30,9 @@
 class SkFlattenableReadBuffer;
 class SkFlattenableWriteBuffer;
 
+// This is an opaque class, not interpreted by skia
+class SkGpuTexture;
+
 /** \class SkBitmap
 
     The SkBitmap class specifies a raster bitmap. A bitmap has an integer width
@@ -262,6 +265,10 @@
                        fColorTable != NULL);
     }
 
+    /** Returns the pixelRef's texture, or NULL
+     */
+    SkGpuTexture* getTexture() const;
+
     /** Return the bitmap's colortable (if any). Does not affect the colortable's
         reference count.
     */
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h
index 82e5ca7..8375cc7 100644
--- a/include/core/SkPixelRef.h
+++ b/include/core/SkPixelRef.h
@@ -25,6 +25,9 @@
 class SkFlattenableReadBuffer;
 class SkFlattenableWriteBuffer;
 
+// this is an opaque class, not interpreted by skia
+class SkGpuTexture;
+
 /** \class SkPixelRef
 
     This class is the smart container for pixel memory, and is used with
@@ -105,6 +108,10 @@
     */
     void setURI(const SkString& uri) { fURI = uri; }
 
+    /** Are we really wrapping a texture instead of a bitmap?
+     */
+    virtual SkGpuTexture* getTexture() { return NULL; }
+
     // serialization
 
     typedef SkPixelRef* (*Factory)(SkFlattenableReadBuffer&);
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 0276897..970ac01 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -371,6 +371,10 @@
     }
 }
 
+SkGpuTexture* SkBitmap::getTexture() const {
+    return fPixelRef ? fPixelRef->getTexture() : NULL;
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 
 SkMallocPixelRef::SkMallocPixelRef(void* storage, size_t size,