summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--native/graphics/jni/imagedecoder.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/native/graphics/jni/imagedecoder.cpp b/native/graphics/jni/imagedecoder.cpp
index 385e455e3e1f..b0c8c612036a 100644
--- a/native/graphics/jni/imagedecoder.cpp
+++ b/native/graphics/jni/imagedecoder.cpp
@@ -442,6 +442,15 @@ int AImageDecoder_advanceFrame(AImageDecoder* decoder) {
return ANDROID_IMAGE_DECODER_BAD_PARAMETER;
}
+ const auto colorType = imageDecoder->getOutputInfo().colorType();
+ switch (colorType) {
+ case kN32_SkColorType:
+ case kRGBA_F16_SkColorType:
+ break;
+ default:
+ return ANDROID_IMAGE_DECODER_INVALID_STATE;
+ }
+
if (imageDecoder->advanceFrame()) {
return ANDROID_IMAGE_DECODER_SUCCESS;
}