aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkGifCodec.cpp
diff options
context:
space:
mode:
authorGravatar Leon Scroggins III <scroggo@google.com>2017-01-30 13:55:14 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-30 21:22:29 +0000
commite4ba1059ddf4d9a1e41b01c378f1a5cc15669343 (patch)
treea4d1c0150ded54ab329110bdf71bcd22fcc031fb /src/codec/SkGifCodec.cpp
parent2589042daf42efb56896a0653a9a1ce4f825dd53 (diff)
GIF: Only report a frame after knowing dependency
Previously, getFrameInfo might report a frame that was truncated prior to setting its requiredFrame. As a result, fRequiredFrame may be different depending on how much data has already been received. If there is a local color table, do not report the frame until the color table has been received, since that is used to determine fRequiredFrame. If there is no local color table, set fRequiredFrame and report the frame after reading the header. Add a test. Replace make_from_resource with GetResourceAsData Change-Id: I1b697f766c1d0e1e12ab2ae1d27167af5193395d Reviewed-on: https://skia-review.googlesource.com/7756 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'src/codec/SkGifCodec.cpp')
-rw-r--r--src/codec/SkGifCodec.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/codec/SkGifCodec.cpp b/src/codec/SkGifCodec.cpp
index 9c7746da65..af0e8bc242 100644
--- a/src/codec/SkGifCodec.cpp
+++ b/src/codec/SkGifCodec.cpp
@@ -240,8 +240,7 @@ SkCodec::Result SkGifCodec::prepareToDecode(const SkImageInfo& dstInfo, SkPMColo
return gif_error("frame index out of range!\n", kIncompleteInput);
}
- auto& localMap = fReader->frameContext(frameIndex)->localColorMap();
- if (localMap.numColors() && !localMap.isDefined()) {
+ if (!fReader->frameContext(frameIndex)->reachedStartOfData()) {
// We have parsed enough to know that there is a color map, but cannot
// parse the map itself yet. Exit now, so we do not build an incorrect
// table.