Add the method isOpaque() to SkImage

BUG=skia:2766
R=junov@chromium.org, halcanary@google.com, scroggo@google.com, reed@google.com, bsalomon@google.com

Author: piotaixr@chromium.org

Review URL: https://codereview.chromium.org/406673003
diff --git a/src/image/SkImage_Codec.cpp b/src/image/SkImage_Codec.cpp
index 21c844d..0b14216 100644
--- a/src/image/SkImage_Codec.cpp
+++ b/src/image/SkImage_Codec.cpp
@@ -22,6 +22,8 @@
     virtual void onDrawRectToRect(SkCanvas*, const SkRect*, const SkRect&,
                                   const SkPaint*) const SK_OVERRIDE;
 
+    virtual bool isOpaque() const SK_OVERRIDE;
+
 private:
     SkData*     fEncodedData;
     SkBitmap    fBitmap;
@@ -78,3 +80,8 @@
 
     return SkNEW_ARGS(SkImage_Codec, (data, bitmap.width(), bitmap.height()));
 }
+
+
+bool SkImage_Codec::isOpaque() const {
+    return fBitmap.isOpaque();
+}
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 0918412..d98a536 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -31,6 +31,9 @@
     virtual SkShader* onNewShader(SkShader::TileMode,
                                   SkShader::TileMode,
                                   const SkMatrix* localMatrix) const SK_OVERRIDE;
+
+    virtual bool isOpaque() const SK_OVERRIDE;
+
 private:
     SkBitmap    fBitmap;
 
@@ -72,6 +75,10 @@
     return fBitmap.copyTo(dst, kN32_SkColorType);
 }
 
+bool SkImage_Gpu::isOpaque() const {
+    return fBitmap.isOpaque();
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 
 SkImage* SkImage::NewTexture(const SkBitmap& bitmap) {
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp
index a1cd602..a7e4e00 100644
--- a/src/image/SkImage_Raster.cpp
+++ b/src/image/SkImage_Raster.cpp
@@ -70,6 +70,8 @@
                                   SkShader::TileMode,
                                   const SkMatrix* localMatrix) const SK_OVERRIDE;
 
+    virtual bool isOpaque() const SK_OVERRIDE;
+
     SkImage_Raster(const SkBitmap& bm)
         : INHERITED(bm.width(), bm.height())
         , fBitmap(bm) {}
@@ -219,3 +221,7 @@
 SkPixelRef* SkBitmapImageGetPixelRef(SkImage* image) {
     return ((SkImage_Raster*)image)->getPixelRef();
 }
+
+bool SkImage_Raster::isOpaque() const {
+    return fBitmap.isOpaque();
+}