Index: src/codec/SkPngCodec.h |
diff --git a/src/codec/SkPngCodec.h b/src/codec/SkPngCodec.h |
index a4c20c708f16e73684c1e013241b9f7fafd700b1..3b40da916f45333a927364c3d852e2996fab7b30 100644 |
--- a/src/codec/SkPngCodec.h |
+++ b/src/codec/SkPngCodec.h |
@@ -39,25 +39,38 @@ protected: |
void* fPtr; |
}; |
+ SkPngCodec(const SkEncodedInfo&, const SkImageInfo&, SkStream*, SkPngChunkReader*, |
+ void* png_ptr, void* info_ptr, int bitDepth); |
+ |
Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMColor*, int*, int*) |
override; |
SkEncodedFormat onGetEncodedFormat() const override { return kPNG_SkEncodedFormat; } |
bool onRewind() override; |
uint64_t onGetFillValue(const SkImageInfo&) const override; |
- // Helper to set up swizzler, color xforms, and color table. Also calls png_read_update_info. |
- bool initializeXforms(const SkImageInfo& dstInfo, const Options&, SkPMColor* colorPtr, |
- int* colorCount); |
- void initializeSwizzler(const SkImageInfo& dstInfo, const Options&); |
SkSampler* getSampler(bool createIfNecessary) override; |
- void allocateStorage(const SkImageInfo& dstInfo); |
- void applyXformRow(void* dst, const void* src, SkColorType, SkAlphaType, int width); |
+ void applyXformRow(void* dst, const void* src, SkColorType); |
- virtual int readRows(const SkImageInfo& dstInfo, void* dst, size_t rowBytes, int count, |
- int startRow) = 0; |
+ voidp png_ptr() { return fPng_ptr; } |
+ voidp info_ptr() { return fInfo_ptr; } |
- SkPngCodec(const SkEncodedInfo&, const SkImageInfo&, SkStream*, SkPngChunkReader*, |
- void* png_ptr, void* info_ptr, int, int); |
+ SkSwizzler* swizzler() { return fSwizzler; } |
+ |
+ // Initialize variables used by applyXformRow. |
+ void initializeXformAlphaAndWidth(); |
+ |
+ /** |
+ * Pass available input to libpng to process it. |
+ * |
+ * libpng will call any relevant callbacks installed. This will continue decoding |
+ * until it reaches the end of the file, or until a callback tells libpng to stop. |
+ */ |
+ void processData(); |
+ |
+ Result onStartIncrementalDecode(const SkImageInfo& dstInfo, void* pixels, size_t rowBytes, |
+ const SkCodec::Options&, |
+ SkPMColor* ctable, int* ctableCount) override; |
+ Result onIncrementalDecode(int*) override; |
SkAutoTUnref<SkPngChunkReader> fPngChunkReader; |
voidp fPng_ptr; |
@@ -68,12 +81,8 @@ protected: |
SkAutoTDelete<SkSwizzler> fSwizzler; |
std::unique_ptr<SkColorSpaceXform> fColorXform; |
SkAutoTMalloc<uint8_t> fStorage; |
- uint8_t* fSwizzlerSrcRow; |
uint32_t* fColorXformSrcRow; |
- size_t fSrcRowBytes; |
- |
- const int fNumberPasses; |
- int fBitDepth; |
+ const int fBitDepth; |
private: |
@@ -89,9 +98,20 @@ private: |
}; |
bool createColorTable(const SkImageInfo& dstInfo, int* ctableCount); |
+ // Helper to set up swizzler, color xforms, and color table. Also calls png_read_update_info. |
+ bool initializeXforms(const SkImageInfo& dstInfo, const Options&, SkPMColor* colorPtr, |
+ int* colorCount); |
+ void initializeSwizzler(const SkImageInfo& dstInfo, const Options&); |
+ void allocateStorage(const SkImageInfo& dstInfo); |
void destroyReadStruct(); |
- XformMode fXformMode; |
+ virtual Result decodeAllRows(void* dst, size_t rowBytes, int* rowsDecoded) = 0; |
+ virtual void setRange(int firstRow, int lastRow, void* dst, size_t rowBytes) = 0; |
+ virtual Result decode(int* rowsDecoded) = 0; |
+ |
+ XformMode fXformMode; |
+ SkAlphaType fXformAlphaType; |
+ int fXformWidth; |
typedef SkCodec INHERITED; |
}; |