summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2017-11-02 13:33:03 -0700
committerSean McCreary <mccreary@mcwest.org>2018-01-13 20:32:59 -0700
commit61e42c38dea46a171d5c782e8a9875a607e83748 (patch)
treecbacd9ef06cd4c9e86e2b20ffa7eedb67adf65e3
parentf597bbffa63b7aab1c6fb82cc8b0997ca64a0e99 (diff)
downloadandroid_frameworks_ex-61e42c38dea46a171d5c782e8a9875a607e83748.tar.gz
android_frameworks_ex-61e42c38dea46a171d5c782e8a9875a607e83748.tar.bz2
android_frameworks_ex-61e42c38dea46a171d5c782e8a9875a607e83748.zip
Skip composition of frames lacking a color map
Bug:68399117 Change-Id: I32f1d6856221b8a60130633edb69da2d2986c27c (cherry picked from commit 0dc887f70eeea8d707cb426b96c6756edd1c607d)
-rw-r--r--framesequence/jni/FrameSequence_gif.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/framesequence/jni/FrameSequence_gif.cpp b/framesequence/jni/FrameSequence_gif.cpp
index 5118319..3ba09dc 100644
--- a/framesequence/jni/FrameSequence_gif.cpp
+++ b/framesequence/jni/FrameSequence_gif.cpp
@@ -307,19 +307,18 @@ long FrameSequenceState_gif::drawFrame(int frameNr,
cmap = frame.ImageDesc.ColorMap;
}
- if (cmap == NULL || cmap->ColorCount != (1 << cmap->BitsPerPixel)) {
- ALOGW("Warning: potentially corrupt color map");
- }
-
- const unsigned char* src = (unsigned char*)frame.RasterBits;
- Color8888* dst = outputPtr + frame.ImageDesc.Left +
- frame.ImageDesc.Top * outputPixelStride;
- GifWord copyWidth, copyHeight;
- getCopySize(frame.ImageDesc, width, height, copyWidth, copyHeight);
- for (; copyHeight > 0; copyHeight--) {
- copyLine(dst, src, cmap, gcb.TransparentColor, copyWidth);
- src += frame.ImageDesc.Width;
- dst += outputPixelStride;
+ // If a cmap is missing, the frame can't be decoded, so we skip it.
+ if (cmap) {
+ const unsigned char* src = (unsigned char*)frame.RasterBits;
+ Color8888* dst = outputPtr + frame.ImageDesc.Left +
+ frame.ImageDesc.Top * outputPixelStride;
+ GifWord copyWidth, copyHeight;
+ getCopySize(frame.ImageDesc, width, height, copyWidth, copyHeight);
+ for (; copyHeight > 0; copyHeight--) {
+ copyLine(dst, src, cmap, gcb.TransparentColor, copyWidth);
+ src += frame.ImageDesc.Width;
+ dst += outputPixelStride;
+ }
}
}
}