65 size_t minBytes,
size_t increment) {
79 ERRORF(r,
"Failed to create codec for %s with %zu bytes",
name, minBytes);
95 if (stream->isAllDataReceived()) {
96 ERRORF(r,
"Failed to start incremental decode\n");
100 stream->addNewData(increment);
105 partialCodec->getFrameCount();
115 if (stream->isAllDataReceived()) {
116 ERRORF(r,
"Failed to completely decode %s",
name);
120 stream->addNewData(increment);
177 auto path =
"images/colorTables.gif";
185 ERRORF(r,
"Failed to create codec from %s", path);
189 auto frameInfo = codec->getFrameInfo();
190 if (frameInfo.size() <= 1) {
191 ERRORF(r,
"Test is uninteresting with 0 or 1 frames");
196 std::unique_ptr<SkCodec> partialCodec(
nullptr);
197 for (
size_t i = 0; !partialCodec; i++) {
198 if (file->size() == i) {
199 ERRORF(r,
"Should have created a partial codec for %s", path);
206 std::vector<SkCodec::FrameInfo> partialInfo;
207 size_t frameToCompare = 0;
209 partialInfo = partialCodec->getFrameInfo();
210 for (; frameToCompare < partialInfo.size(); frameToCompare++) {
212 == frameInfo[frameToCompare].fRequiredFrame);
215 if (frameToCompare == frameInfo.size()) {
219 if (stream->getLength() == file->size()) {
220 ERRORF(r,
"Should have found all frames for %s", path);
223 stream->addNewData(1);
228 auto path =
"images/test640x479.gif";
242 const std::vector<size_t> frameByteCounts = { 455, 69350, 1344, 1346, 1327 };
243 std::vector<SkBitmap> frames;
244 for (
size_t i = 0;
true; i++) {
251 frame.rowBytes(), &opts);
258 if (fullCodec->getFrameInfo().size() > i) {
260 frames.push_back(
frame);
266 ERRORF(r,
"Failed to decode frame %zu from %s", i, path);
270 frames.push_back(
frame);
276 std::unique_ptr<SkStream>(haltingStream)));
278 ERRORF(r,
"Failed to create a partial codec from %s with %zu bytes out of %zu",
279 path, frameByteCounts[0], file->size());
283 SkASSERT(frameByteCounts.size() > frames.size());
284 for (
size_t i = 0; i < frames.size(); i++) {
285 const size_t fullFrameBytes = frameByteCounts[i + 1];
286 const size_t firstHalf = fullFrameBytes / 2;
287 const size_t secondHalf = fullFrameBytes - firstHalf;
290 auto frameInfo = partialCodec->getFrameInfo();
302 ERRORF(r,
"Failed to start incremental decode for %s on frame %zu",
307 result = partialCodec->incrementalDecode();
311 result = partialCodec->incrementalDecode();
314 frameInfo = partialCodec->getFrameInfo();
318 ERRORF(r,
"\tfailure was on frame %zu", i);
379 0x47, 0x49, 0x46, 0x38, 0x39, 0x61,
382 0x0A, 0x00, 0x0A, 0x00, 0x11, 0x00, 0x00,
385 0x2C, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x0A, 0x00, 0x81,
388 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
391 0x02, 0x16, 0x8C, 0x2D, 0x99, 0x87, 0x2A, 0x1C, 0xDC, 0x33, 0xA0, 0x02, 0x75,
392 0xEC, 0x95, 0xFA, 0xA8, 0xDE, 0x60, 0x8C, 0x04, 0x91, 0x4C, 0x01, 0x00,
static std::unique_ptr< SkCodec > MakeFromStream(std::unique_ptr< SkStream >, SkSpan< const SkCodecs::Decoder > decoders, Result *=nullptr, SkPngChunkReader *=nullptr, SelectionPolicy selectionPolicy=SelectionPolicy::kPreferStillImage)