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 "SkCodecPriv.h" | 8 #include "SkCodecPriv.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkColorTable.h" | 10 #include "SkColorTable.h" |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 // We've already read all the scanlines. This is a success. | 558 // We've already read all the scanlines. This is a success. |
559 return kSuccess; | 559 return kSuccess; |
560 } | 560 } |
561 | 561 |
562 // read rest of file, and get additional comment and time chunks in info_ptr | 562 // read rest of file, and get additional comment and time chunks in info_ptr |
563 png_read_end(fPng_ptr, fInfo_ptr); | 563 png_read_end(fPng_ptr, fInfo_ptr); |
564 | 564 |
565 return kSuccess; | 565 return kSuccess; |
566 } | 566 } |
567 | 567 |
568 uint32_t SkPngCodec::onGetFillValue(SkColorType colorType, SkAlphaType alphaType
) const { | 568 uint32_t SkPngCodec::onGetFillValue(SkColorType colorType) const { |
569 const SkPMColor* colorPtr = get_color_ptr(fColorTable.get()); | 569 const SkPMColor* colorPtr = get_color_ptr(fColorTable.get()); |
570 if (colorPtr) { | 570 if (colorPtr) { |
571 return get_color_table_fill_value(colorType, colorPtr, 0); | 571 return get_color_table_fill_value(colorType, colorPtr, 0); |
572 } | 572 } |
573 return INHERITED::onGetFillValue(colorType, alphaType); | 573 return INHERITED::onGetFillValue(colorType); |
574 } | 574 } |
575 | 575 |
576 // Subclass of SkPngCodec which supports scanline decoding | 576 // Subclass of SkPngCodec which supports scanline decoding |
577 class SkPngScanlineDecoder : public SkPngCodec { | 577 class SkPngScanlineDecoder : public SkPngCodec { |
578 public: | 578 public: |
579 SkPngScanlineDecoder(const SkImageInfo& srcInfo, SkStream* stream, | 579 SkPngScanlineDecoder(const SkImageInfo& srcInfo, SkStream* stream, |
580 SkPngChunkReader* chunkReader, png_structp png_ptr, png_infop info_p
tr, int bitDepth) | 580 SkPngChunkReader* chunkReader, png_structp png_ptr, png_infop info_p
tr, int bitDepth) |
581 : INHERITED(srcInfo, stream, chunkReader, png_ptr, info_ptr, bitDepth, 1
) | 581 : INHERITED(srcInfo, stream, chunkReader, png_ptr, info_ptr, bitDepth, 1
) |
582 , fSrcRow(nullptr) | 582 , fSrcRow(nullptr) |
583 {} | 583 {} |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 } | 778 } |
779 | 779 |
780 if (1 == numberPasses) { | 780 if (1 == numberPasses) { |
781 return new SkPngScanlineDecoder(imageInfo, streamDeleter.detach(), chunk
Reader, | 781 return new SkPngScanlineDecoder(imageInfo, streamDeleter.detach(), chunk
Reader, |
782 png_ptr, info_ptr, bitDepth); | 782 png_ptr, info_ptr, bitDepth); |
783 } | 783 } |
784 | 784 |
785 return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.detach(),
chunkReader, | 785 return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.detach(),
chunkReader, |
786 png_ptr, info_ptr, bitDepth, numbe
rPasses); | 786 png_ptr, info_ptr, bitDepth, numbe
rPasses); |
787 } | 787 } |
OLD | NEW |