Update AImageDecoder_getAlphaFlags return value

Bug: 135133301
Test: I2ea58bede5cf49a7947c96e7e6e37f967632ad6b

BAD_PARAMETER is a more sensible value than -1. The other return will
not be reached, but the code is clearer.

Change-Id: I4bee8f238f61a6c6cd13b5458f201f34d34315d9
This commit is contained in:
Leon Scroggins III
2020-01-15 04:09:48 -05:00
parent 4c0487a163
commit d8840bd9f0

View File

@@ -225,13 +225,12 @@ AndroidBitmapFormat AImageDecoderHeaderInfo_getAndroidBitmapFormat(
int AImageDecoderHeaderInfo_getAlphaFlags(const AImageDecoderHeaderInfo* info) {
if (!info) {
// FIXME: Better invalid?
return -1;
return ANDROID_IMAGE_DECODER_BAD_PARAMETER;
}
switch (toDecoder(info)->mCodec->getInfo().alphaType()) {
case kUnknown_SkAlphaType:
LOG_ALWAYS_FATAL("Invalid alpha type");
return -1;
return ANDROID_IMAGE_DECODER_INTERNAL_ERROR;
case kUnpremul_SkAlphaType:
// fall through. premul is the default.
case kPremul_SkAlphaType: