aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/codec/SkAndroidCodec.h
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2015-12-10 13:09:24 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-10 13:09:24 -0800
commit90c4d5fec8a9455729b401fd7818bea221dcada2 (patch)
tree3e1760f325e5fc2a633edd56874da414da352f08 /include/codec/SkAndroidCodec.h
parent6bce4177cb72faac9c10d01d57e17168ae7ecadf (diff)
Add reallyHasAlpha() to SkAndroidCodec
This also modified the default implementation of onReallyHasAlpha() in SkCodec. BUG=skia: Review URL: https://codereview.chromium.org/1518743002
Diffstat (limited to 'include/codec/SkAndroidCodec.h')
-rw-r--r--include/codec/SkAndroidCodec.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/include/codec/SkAndroidCodec.h b/include/codec/SkAndroidCodec.h
index f979886a43..9d02de06f6 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