| 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.h" | 8 #include "SkCodec.h" |
| 9 #include "SkColorTable.h" | 9 #include "SkColorTable.h" |
| 10 #include "SkEncodedFormat.h" | 10 #include "SkEncodedFormat.h" |
| 11 #include "SkImageInfo.h" | 11 #include "SkImageInfo.h" |
| 12 #include "SkRefCnt.h" | 12 #include "SkRefCnt.h" |
| 13 #include "SkSwizzler.h" | 13 #include "SkSwizzler.h" |
| 14 | 14 |
| 15 #ifdef SKIA_PNG_PREFIXED | 15 #ifdef SKIA_PNG_PREFIXED |
| 16 // this must proceed png.h | 16 // this must proceed png.h |
| 17 #include "pngprefix.h" | 17 #include "pngprefix.h" |
| 18 #endif | 18 #endif |
| 19 #include "png.h" | 19 #include "png.h" |
| 20 | 20 |
| 21 class SkScanlineDecoder; | |
| 22 class SkStream; | 21 class SkStream; |
| 23 | 22 |
| 24 class SkPngCodec : public SkCodec { | 23 class SkPngCodec : public SkCodec { |
| 25 public: | 24 public: |
| 26 static bool IsPng(SkStream*); | 25 static bool IsPng(SkStream*); |
| 27 | 26 |
| 28 // Assume IsPng was called and returned true. | 27 // Assume IsPng was called and returned true. |
| 29 static SkCodec* NewFromStream(SkStream*); | 28 static SkCodec* NewFromStream(SkStream*); |
| 30 static SkScanlineDecoder* NewSDFromStream(SkStream*); | |
| 31 | 29 |
| 32 virtual ~SkPngCodec(); | 30 virtual ~SkPngCodec(); |
| 33 | 31 |
| 34 protected: | 32 protected: |
| 35 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMCo
lor*, int*, int*) | 33 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMCo
lor*, int*, int*) |
| 36 override; | 34 override; |
| 37 SkEncodedFormat onGetEncodedFormat() const override { return kPNG_SkEncodedF
ormat; } | 35 SkEncodedFormat onGetEncodedFormat() const override { return kPNG_SkEncodedF
ormat; } |
| 38 bool onRewind() override; | 36 bool onRewind() override; |
| 39 uint32_t onGetFillValue(SkColorType colorType, SkAlphaType alphaType) const
override; | 37 uint32_t onGetFillValue(SkColorType colorType, SkAlphaType alphaType) const
override; |
| 40 bool onReallyHasAlpha() const final; | 38 bool onReallyHasAlpha() const final; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 71 png_structp fPng_ptr; | 69 png_structp fPng_ptr; |
| 72 png_infop fInfo_ptr; | 70 png_infop fInfo_ptr; |
| 73 | 71 |
| 74 // These are stored here so they can be used both by normal decoding and sca
nline decoding. | 72 // These are stored here so they can be used both by normal decoding and sca
nline decoding. |
| 75 SkAutoTUnref<SkColorTable> fColorTable; // May be unpremul. | 73 SkAutoTUnref<SkColorTable> fColorTable; // May be unpremul. |
| 76 SkAutoTDelete<SkSwizzler> fSwizzler; | 74 SkAutoTDelete<SkSwizzler> fSwizzler; |
| 77 | 75 |
| 78 SkSwizzler::SrcConfig fSrcConfig; | 76 SkSwizzler::SrcConfig fSrcConfig; |
| 79 const int fNumberPasses; | 77 const int fNumberPasses; |
| 80 int fBitDepth; | 78 int fBitDepth; |
| 81 | |
| 82 AlphaState fAlphaState; | 79 AlphaState fAlphaState; |
| 83 | 80 |
| 84 bool decodePalette(bool premultiply, int* ctableCount); | 81 bool decodePalette(bool premultiply, int* ctableCount); |
| 85 void destroyReadStruct(); | 82 void destroyReadStruct(); |
| 86 | 83 |
| 87 typedef SkCodec INHERITED; | 84 typedef SkCodec INHERITED; |
| 88 }; | 85 }; |
| OLD | NEW |