Fix convert-to-NIA stillImage check
For example, this GIF image:
https://github.com/google/wuffs/blob/e44920d/test/data/artificial-gif/pixel-data-too-much-bad-lzw.gif
which is 'disassembled' here:
https://github.com/google/wuffs/blob/e44920d/test/data/artificial-gif/pixel-data-too-much-bad-lzw.gif.make-artificial.txt
only has one frame, regardless of how the GIF codec implementation deals
with the LZW-compression error. It is not an animated image.
Nonetheless, frameInfos.size() returns 1, not 0, so prior to this
commit, "stillImage = frameInfos.empty()" assigned false, not true.
See also this Wuffs (not Skia) commit:
https://github.com/google/wuffs/commit/3a9933f2a0af846affe15eb6f10ce26b029bd7a8
Bug: None
Change-Id: Ia69a486abe5c2caa7488c55a37c403e7660ff168
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475436
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
diff --git a/tools/convert-to-nia.cpp b/tools/convert-to-nia.cpp
index 58f9a67..41ea456 100644
--- a/tools/convert-to-nia.cpp
+++ b/tools/convert-to-nia.cpp
@@ -152,10 +152,8 @@
SkDebugf("No frames.\n");
return 1;
}
- // The SkCodec::getFrameInfo comment says that this vector will be empty
- // for still (not animated) images, even though frameCount should be 1.
std::vector<SkCodec::FrameInfo> frameInfos = codec->getFrameInfo();
- bool stillImage = frameInfos.empty();
+ bool stillImage = frameInfos.size() <= 1;
for (int i = 0; i < frameCount; i++) {
SkCodec::Options opts;