aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/codec/SkAndroidCodec.h
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2015-12-11 07:38:50 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-11 07:38:50 -0800
commit9a0e3467da2a61ec81f676c147c21c77de91fccf (patch)
tree34f92186cea75a2af48dc76d3cb0bdf8905d2317 /include/codec/SkAndroidCodec.h
parente804292e805917002cc3d7baa7f967fb20d2c7cb (diff)
Make BitmapRegionDecoder succeed on invalid requests
If the client requests a color type or alpha type that is not supported, we should decode to the default/appropriate color and alpha types to match existing behavior in Android. BUG=skia: Review URL: https://codereview.chromium.org/1513023002
Diffstat (limited to 'include/codec/SkAndroidCodec.h')
-rw-r--r--include/codec/SkAndroidCodec.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/codec/SkAndroidCodec.h b/include/codec/SkAndroidCodec.h
index 9d02de06f6..4062e64dc5 100644
--- a/include/codec/SkAndroidCodec.h
+++ b/include/codec/SkAndroidCodec.h
@@ -53,6 +53,24 @@ public:
SkEncodedFormat getEncodedFormat() const { return fCodec->getEncodedFormat(); }
/**
+ * @param requestedColorType Color type requested by the client
+ *
+ * If it is possible to decode to requestedColorType, this returns
+ * requestedColorType. Otherwise, this returns whichever color type
+ * is suggested by the codec as the best match for the encoded data.
+ */
+ SkColorType computeOutputColorType(SkColorType requestedColorType);
+
+ /**
+ * @param requestedUnpremul Indicates if the client requested
+ * unpremultiplied output
+ *
+ * Returns the appropriate alpha type to decode to. If the image
+ * has alpha, the value of requestedUnpremul will be honored.
+ */
+ SkAlphaType computeOutputAlphaType(bool requestedUnpremul);
+
+ /**
* Returns the dimensions of the scaled output image, for an input
* sampleSize.
*