Index: include/codec/SkAndroidCodec.h |
diff --git a/include/codec/SkAndroidCodec.h b/include/codec/SkAndroidCodec.h |
index f979886a43ec33c573de3553b49651a8a06d7025..9d02de06f6d5d265bddd810e9bd689b063c49edb 100644 |
--- a/include/codec/SkAndroidCodec.h |
+++ b/include/codec/SkAndroidCodec.h |
@@ -50,7 +50,7 @@ public: |
/** |
* Format of the encoded data. |
*/ |
- SkEncodedFormat getEncodedFormat() const { return this->onGetEncodedFormat(); } |
+ SkEncodedFormat getEncodedFormat() const { return fCodec->getEncodedFormat(); } |
/** |
* Returns the dimensions of the scaled output image, for an input |
@@ -208,11 +208,23 @@ public: |
*/ |
SkCodec::Result getAndroidPixels(const SkImageInfo& info, void* pixels, size_t rowBytes); |
+ /** |
+ * Some images may initially report that they have alpha due to the format |
+ * of the encoded data, but then never use any colors which have alpha |
+ * less than 100%. This function can be called *after* decoding to |
+ * determine if such an image truly had alpha. Calling it before decoding |
+ * is undefined. |
+ * FIXME: see skbug.com/3582. |
+ */ |
+ bool reallyHasAlpha() const { |
+ return fCodec->reallyHasAlpha(); |
+ } |
+ |
protected: |
- SkAndroidCodec(const SkImageInfo&); |
+ SkAndroidCodec(SkCodec*); |
- virtual SkEncodedFormat onGetEncodedFormat() const = 0; |
+ SkCodec* codec() const { return fCodec.get(); } |
virtual SkISize onGetSampledDimensions(int sampleSize) const = 0; |
@@ -226,5 +238,7 @@ private: |
// This will always be a reference to the info that is contained by the |
// embedded SkCodec. |
const SkImageInfo& fInfo; |
+ |
+ SkAutoTDelete<SkCodec> fCodec; |
}; |
#endif // SkAndroidCodec_DEFINED |