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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 SkASSERT(false); | 598 SkASSERT(false); |
599 return true; | 599 return true; |
600 } | 600 } |
601 | 601 |
602 // Subclass of SkPngCodec which supports scanline decoding | 602 // Subclass of SkPngCodec which supports scanline decoding |
603 class SkPngScanlineDecoder : public SkPngCodec { | 603 class SkPngScanlineDecoder : public SkPngCodec { |
604 public: | 604 public: |
605 SkPngScanlineDecoder(const SkImageInfo& srcInfo, SkStream* stream, | 605 SkPngScanlineDecoder(const SkImageInfo& srcInfo, SkStream* stream, |
606 png_structp png_ptr, png_infop info_ptr, int bitDepth) | 606 png_structp png_ptr, png_infop info_ptr, int bitDepth) |
607 : INHERITED(srcInfo, stream, png_ptr, info_ptr, bitDepth, 1) | 607 : INHERITED(srcInfo, stream, png_ptr, info_ptr, bitDepth, 1) |
| 608 , fAlphaState(kUnknown_AlphaState) |
608 , fSrcRow(nullptr) | 609 , fSrcRow(nullptr) |
609 , fAlphaState(kUnknown_AlphaState) | |
610 {} | 610 {} |
611 | 611 |
612 Result onStartScanlineDecode(const SkImageInfo& dstInfo, const Options& opti
ons, | 612 Result onStartScanlineDecode(const SkImageInfo& dstInfo, const Options& opti
ons, |
613 SkPMColor ctable[], int* ctableCount) override { | 613 SkPMColor ctable[], int* ctableCount) override { |
614 if (!conversion_possible(dstInfo, this->getInfo())) { | 614 if (!conversion_possible(dstInfo, this->getInfo())) { |
615 return kInvalidConversion; | 615 return kInvalidConversion; |
616 } | 616 } |
617 | 617 |
618 const Result result = this->initializeSwizzler(dstInfo, options, ctable, | 618 const Result result = this->initializeSwizzler(dstInfo, options, ctable, |
619 ctableCount); | 619 ctableCount); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 } | 836 } |
837 | 837 |
838 if (1 == numberPasses) { | 838 if (1 == numberPasses) { |
839 return new SkPngScanlineDecoder(imageInfo, streamDeleter.detach(), png_p
tr, info_ptr, | 839 return new SkPngScanlineDecoder(imageInfo, streamDeleter.detach(), png_p
tr, info_ptr, |
840 bitDepth); | 840 bitDepth); |
841 } | 841 } |
842 | 842 |
843 return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.detach(),
png_ptr, | 843 return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.detach(),
png_ptr, |
844 info_ptr, bitDepth, numberPasses); | 844 info_ptr, bitDepth, numberPasses); |
845 } | 845 } |
846 | |
OLD | NEW |