OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 } | 410 } |
411 | 411 |
412 void WEBPImageDecoder::decode(size_t index) { | 412 void WEBPImageDecoder::decode(size_t index) { |
413 if (failed()) | 413 if (failed()) |
414 return; | 414 return; |
415 | 415 |
416 Vector<size_t> framesToDecode = findFramesToDecode(index); | 416 Vector<size_t> framesToDecode = findFramesToDecode(index); |
417 | 417 |
418 DCHECK(m_demux); | 418 DCHECK(m_demux); |
419 for (auto i = framesToDecode.rbegin(); i != framesToDecode.rend(); ++i) { | 419 for (auto i = framesToDecode.rbegin(); i != framesToDecode.rend(); ++i) { |
420 if ((m_formatFlags & ANIMATION_FLAG) && !initFrameBuffer(*i)) | 420 if ((m_formatFlags & ANIMATION_FLAG) && !initFrameBuffer(*i)) { |
| 421 setFailed(); |
421 return; | 422 return; |
| 423 } |
| 424 |
422 WebPIterator webpFrame; | 425 WebPIterator webpFrame; |
423 if (!WebPDemuxGetFrame(m_demux, *i + 1, &webpFrame)) { | 426 if (!WebPDemuxGetFrame(m_demux, *i + 1, &webpFrame)) { |
424 setFailed(); | 427 setFailed(); |
425 } else { | 428 } else { |
426 decodeSingleFrame(webpFrame.fragment.bytes, webpFrame.fragment.size, *i); | 429 decodeSingleFrame(webpFrame.fragment.bytes, webpFrame.fragment.size, *i); |
427 WebPDemuxReleaseIterator(&webpFrame); | 430 WebPDemuxReleaseIterator(&webpFrame); |
428 } | 431 } |
429 if (failed()) | 432 if (failed()) |
430 return; | 433 return; |
431 | 434 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 return false; | 512 return false; |
510 } | 513 } |
511 // FALLTHROUGH | 514 // FALLTHROUGH |
512 default: | 515 default: |
513 clear(); | 516 clear(); |
514 return setFailed(); | 517 return setFailed(); |
515 } | 518 } |
516 } | 519 } |
517 | 520 |
518 } // namespace blink | 521 } // namespace blink |
OLD | NEW |