Merge "Implement AImageDecoder_getRepeatCount"
This commit is contained in:
committed by
Android (Google) Code Review
commit
377af5a74f
@@ -353,3 +353,18 @@ bool AImageDecoder_isAnimated(AImageDecoder* decoder) {
|
||||
ImageDecoder* imageDecoder = toDecoder(decoder);
|
||||
return imageDecoder->mCodec->codec()->getFrameCount() > 1;
|
||||
}
|
||||
|
||||
int32_t AImageDecoder_getRepeatCount(AImageDecoder* decoder) {
|
||||
if (!decoder) return ANDROID_IMAGE_DECODER_BAD_PARAMETER;
|
||||
|
||||
ImageDecoder* imageDecoder = toDecoder(decoder);
|
||||
const int count = imageDecoder->mCodec->codec()->getRepetitionCount();
|
||||
|
||||
// Skia should not report anything out of range, but defensively treat
|
||||
// negative and too big as INFINITE.
|
||||
if (count == SkCodec::kRepetitionCountInfinite || count < 0
|
||||
|| count > std::numeric_limits<int32_t>::max()) {
|
||||
return ANDROID_IMAGE_DECODER_INFINITE;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ LIBJNIGRAPHICS {
|
||||
AImageDecoder_computeSampledSize; # introduced=30
|
||||
AImageDecoder_setCrop; # introduced=30
|
||||
AImageDecoder_isAnimated; # introduced=31
|
||||
AImageDecoder_getRepeatCount; # introduced=31
|
||||
AImageDecoderHeaderInfo_getWidth; # introduced=30
|
||||
AImageDecoderHeaderInfo_getHeight; # introduced=30
|
||||
AImageDecoderHeaderInfo_getMimeType; # introduced=30
|
||||
|
||||
Reference in New Issue
Block a user