OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkCodec_libpng.h" | 8 #include "SkCodec_libpng.h" |
9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 // decoding is the exception, since it needs to rewind between | 761 // decoding is the exception, since it needs to rewind between |
762 // calls to getScanlines. Keep track of fCurrScanline, to undo the | 762 // calls to getScanlines. Keep track of fCurrScanline, to undo the |
763 // reset. | 763 // reset. |
764 const int currScanline = this->nextScanline(); | 764 const int currScanline = this->nextScanline(); |
765 // This method would never be called if currScanline is -1 | 765 // This method would never be called if currScanline is -1 |
766 SkASSERT(currScanline != -1); | 766 SkASSERT(currScanline != -1); |
767 | 767 |
768 if (!this->rewindIfNeeded()) { | 768 if (!this->rewindIfNeeded()) { |
769 return kCouldNotRewind; | 769 return kCouldNotRewind; |
770 } | 770 } |
771 this->updateNextScanline(currScanline); | 771 this->updateCurrScanline(currScanline); |
772 } | 772 } |
773 | 773 |
774 if (setjmp(png_jmpbuf(this->png_ptr()))) { | 774 if (setjmp(png_jmpbuf(this->png_ptr()))) { |
775 SkCodecPrintf("setjmp long jump!\n"); | 775 SkCodecPrintf("setjmp long jump!\n"); |
776 // FIXME (msarett): Returning 0 is pessimistic. If we can complete
a single pass, | 776 // FIXME (msarett): Returning 0 is pessimistic. If we can complete
a single pass, |
777 // we may be able to report that all of the memory has been initiali
zed. Even if we | 777 // we may be able to report that all of the memory has been initiali
zed. Even if we |
778 // fail on the first pass, we can still report than some scanlines a
re initialized. | 778 // fail on the first pass, we can still report than some scanlines a
re initialized. |
779 return 0; | 779 return 0; |
780 } | 780 } |
781 SkAutoMalloc storage(count * fSrcRowBytes); | 781 SkAutoMalloc storage(count * fSrcRowBytes); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 } | 866 } |
867 | 867 |
868 if (1 == numberPasses) { | 868 if (1 == numberPasses) { |
869 return new SkPngScanlineDecoder(imageInfo, streamDeleter.detach(), chunk
Reader, | 869 return new SkPngScanlineDecoder(imageInfo, streamDeleter.detach(), chunk
Reader, |
870 png_ptr, info_ptr, bitDepth); | 870 png_ptr, info_ptr, bitDepth); |
871 } | 871 } |
872 | 872 |
873 return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.detach(),
chunkReader, | 873 return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.detach(),
chunkReader, |
874 png_ptr, info_ptr, bitDepth, numbe
rPasses); | 874 png_ptr, info_ptr, bitDepth, numbe
rPasses); |
875 } | 875 } |
OLD | NEW |