aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/gif
diff options
context:
space:
mode:
authorGravatar Leon Scroggins III <scroggo@google.com>2017-07-18 16:22:52 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-19 14:43:26 +0000
commite726e7ca0c99c75f447e6c22b7d341ce921c4e50 (patch)
tree209aa6a36236ab395c38810f1378c50e8a260b29 /third_party/gif
parentd81977f51b865de191a859309055b8992f25698b (diff)
Report first GIF frame after knowing its meta data
Previously, we reported the first image as soon as it was available. As a result, in crrev.com/2565323003, InitializeNewFrame might be called before the metadata is known, meaning it would read the wrong metadata. Instead of looking at the imagesCount(), SkGifCodec::NewFromStream looks at frameContext(0), which may still exist even if it's not yet counted in imagesCount(). Add a test that confirms the desired behavior. Change-Id: Ib392721ecd2218ba0fcd35aaa64117c0ba3e4ea6 Reviewed-on: https://skia-review.googlesource.com/24405 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'third_party/gif')
-rw-r--r--third_party/gif/SkGifImageReader.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/third_party/gif/SkGifImageReader.h b/third_party/gif/SkGifImageReader.h
index 0b89b04818..0ba767ee89 100644
--- a/third_party/gif/SkGifImageReader.h
+++ b/third_party/gif/SkGifImageReader.h
@@ -321,11 +321,9 @@ public:
int imagesCount() const
{
- // Report the first frame immediately, so the parser can stop when it
- // sees the size on a SizeQuery.
const size_t frames = m_frames.size();
- if (frames <= 1) {
- return static_cast<int>(frames);
+ if (!frames) {
+ return 0;
}
// This avoids counting an empty frame when the file is truncated (or