Chromium Code Reviews| 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 "SkPngChunkReader.h" | 10 #include "SkPngChunkReader.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 override; | 31 override; |
| 32 SkEncodedFormat onGetEncodedFormat() const override { return kPNG_SkEncodedF ormat; } | 32 SkEncodedFormat onGetEncodedFormat() const override { return kPNG_SkEncodedF ormat; } |
| 33 bool onRewind() override; | 33 bool onRewind() override; |
| 34 uint32_t onGetFillValue(SkColorType) const override; | 34 uint32_t onGetFillValue(SkColorType) const override; |
| 35 | 35 |
| 36 // Helper to set up swizzler and color table. Also calls png_read_update_inf o. | 36 // Helper to set up swizzler and color table. Also calls png_read_update_inf o. |
| 37 Result initializeSwizzler(const SkImageInfo& requestedInfo, const Options&, | 37 Result initializeSwizzler(const SkImageInfo& requestedInfo, const Options&, |
| 38 SkPMColor*, int* ctableCount); | 38 SkPMColor*, int* ctableCount); |
| 39 SkSampler* getSampler(bool createIfNecessary) override { | 39 SkSampler* getSampler(bool createIfNecessary) override { |
| 40 SkASSERT(fSwizzler); | 40 SkASSERT(fSwizzler); |
| 41 fInPlaceSwizzle = false; | |
|
msarett
2016/02/05 20:48:18
Problem:
Here we assume that the client is callin
| |
| 41 return fSwizzler; | 42 return fSwizzler; |
| 42 } | 43 } |
| 43 | 44 |
| 44 SkPngCodec(const SkImageInfo&, SkStream*, SkPngChunkReader*, png_structp, pn g_infop, int, int); | 45 SkPngCodec(const SkImageInfo&, SkStream*, SkPngChunkReader*, png_structp, pn g_infop, int, int); |
| 45 | 46 |
| 46 png_structp png_ptr() { return fPng_ptr; } | 47 png_structp png_ptr() { return fPng_ptr; } |
| 47 SkSwizzler* swizzler() { return fSwizzler; } | 48 SkSwizzler* swizzler() { return fSwizzler; } |
| 48 SkSwizzler::SrcConfig srcConfig() const { return fSrcConfig; } | 49 SkSwizzler::SrcConfig srcConfig() const { return fSrcConfig; } |
| 49 int numberPasses() const { return fNumberPasses; } | 50 int numberPasses() const { return fNumberPasses; } |
| 51 bool inPlaceSwizzle() { return fInPlaceSwizzle; } | |
| 50 | 52 |
| 51 private: | 53 private: |
| 52 SkAutoTUnref<SkPngChunkReader> fPngChunkReader; | 54 SkAutoTUnref<SkPngChunkReader> fPngChunkReader; |
| 53 png_structp fPng_ptr; | 55 png_structp fPng_ptr; |
| 54 png_infop fInfo_ptr; | 56 png_infop fInfo_ptr; |
| 55 | 57 |
| 56 // These are stored here so they can be used both by normal decoding and sca nline decoding. | 58 // These are stored here so they can be used both by normal decoding and sca nline decoding. |
| 57 SkAutoTUnref<SkColorTable> fColorTable; // May be unpremul. | 59 SkAutoTUnref<SkColorTable> fColorTable; // May be unpremul. |
| 58 SkAutoTDelete<SkSwizzler> fSwizzler; | 60 SkAutoTDelete<SkSwizzler> fSwizzler; |
| 59 | 61 |
| 60 SkSwizzler::SrcConfig fSrcConfig; | 62 SkSwizzler::SrcConfig fSrcConfig; |
| 61 const int fNumberPasses; | 63 const int fNumberPasses; |
| 62 int fBitDepth; | 64 int fBitDepth; |
| 65 bool fInPlaceSwizzle; | |
| 63 | 66 |
| 64 bool decodePalette(bool premultiply, int* ctableCount); | 67 bool decodePalette(bool premultiply, int* ctableCount); |
| 65 void destroyReadStruct(); | 68 void destroyReadStruct(); |
| 66 | 69 |
| 67 typedef SkCodec INHERITED; | 70 typedef SkCodec INHERITED; |
| 68 }; | 71 }; |
| OLD | NEW |