diff options
author | Chris Craik <ccraik@google.com> | 2017-11-08 02:02:15 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-11-08 02:02:15 +0000 |
commit | 6e67fc565b69602289e939e0efcb11a9463508d0 (patch) | |
tree | cbacd9ef06cd4c9e86e2b20ffa7eedb67adf65e3 | |
parent | 75f060c15b9f4956867e0b53b1a35684d803f638 (diff) | |
parent | 65fa609014f6ade8c80d16d4a02dbe23cdfa97aa (diff) | |
download | ex-6e67fc565b69602289e939e0efcb11a9463508d0.tar.gz |
Skip composition of frames lacking a color map am: 0dc887f70e am: d615be0039 am: 5c24be498e am: 5943b3b00d am: 23f4980f7e am: c3621ebb09 am: 73bf156019
am: 65fa609014
Change-Id: I9ef1cc7a26021acd7a8ae44f967d48dabdddc297
-rw-r--r-- | framesequence/jni/FrameSequence_gif.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/framesequence/jni/FrameSequence_gif.cpp b/framesequence/jni/FrameSequence_gif.cpp index 5118319a..3ba09dca 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; + } } } } |