summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Leon Scroggins III <scroggo@google.com> 2021-04-26 15:15:45 -0400
committer Leon Scroggins III <scroggo@google.com> 2021-04-26 15:37:32 -0400
commitcf485437a02da258219516c72bf57dcb579a0d8e (patch)
treec72160e37261e9cd30c3b33e6e8130591f2ececb
parent5bab982501f472655f4d9b300c792e96621fde2c (diff)
AImageDecoder: only support animation for F16 and 8888 (header)
Bug: 180594747 Test: I51dedd94aa8ff5d6846cada96861ffca30d509d7 In particular, a client might expect that ANDROID_BITMAP_FORMAT_RGB_565 is supported. (ANDROID_BITMAP_FORMAT_RGBA_4444 is not supported at all, and ANDROID_BITMAP_FORMAT_NONE is an invalid request. ANDROID_BITMAP_FORMAT_A_8 is only supported for PNG and JPEG, and AImageDecoder does not support multiframe images in those formats anyway.) However, 565 requires that the image be opaque. Even if the first frame is opaque, it is possible that a later frame is not. Moreover, the frame data in a later frame may include transparent pixels, even if the resulting frame is opaque after blending with the frame buffer. In that case, libwebp and libgifcodec decode the frame data directly to 565, so the fact that there were transparent pixels has been lost, and there is no way to properly blend with the prior frame. For clarity, specify the formats supported, rather than the ones not supported. Change-Id: I03818703dc79942be4e574db31c6e2927ab571ed
-rw-r--r--include/android/imagedecoder.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/android/imagedecoder.h b/include/android/imagedecoder.h
index 8d1bf99fe7..c3d3a4b35a 100644
--- a/include/android/imagedecoder.h
+++ b/include/android/imagedecoder.h
@@ -739,6 +739,9 @@ int32_t AImageDecoder_getRepeatCount(AImageDecoder* _Nonnull decoder)
* skipping frames in an image with such frames may not produce the correct
* results.
*
+ * Only supported by {@link ANDROID_BITMAP_FORMAT_RGBA_8888} and
+ * {@link ANDROID_BITMAP_FORMAT_RGBA_F16}.
+ *
* @param decoder an {@link AImageDecoder} object.
* @return {@link ANDROID_IMAGE_DECODER_SUCCESS} on success or a value
* indicating the reason for the failure.
@@ -747,6 +750,8 @@ int32_t AImageDecoder_getRepeatCount(AImageDecoder* _Nonnull decoder)
* - {@link ANDROID_IMAGE_DECODER_BAD_PARAMETER}: The AImageDecoder
* represents an image that is not animated (see
* {@link AImageDecoder_isAnimated}) or the AImageDecoder is null.
+ * - {@link ANDROID_IMAGE_DECODER_INVALID_STATE): The requested
+ * {@link AndroidBitmapFormat} does not support animation.
* - {@link ANDROID_IMAGE_DECODER_INCOMPLETE}: The input appears
* to be truncated. The client must call {@link AImageDecoder_rewind}
* before calling {@link AImageDecoder_decodeImage} again.