From 1c005e4a38e29d648ecebada25d3a718155043a3 Mon Sep 17 00:00:00 2001 From: scroggo Date: Tue, 4 Aug 2015 09:24:45 -0700 Subject: Create a scanline decoder without creating a codec Prior to this CL, if a client wanted to decode scanlines, they had to create an SkCodec in order to get an SkScanlineDecoder. This introduces complications if input data is not easily shared between the two objects. Instead, add methods to SkScanlineDecoder for creating a new one from input data, and remove the creation functions from SkCodec. Update DM and tests. Review URL: https://codereview.chromium.org/1267583002 --- src/codec/SkCodec_libpng.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/codec/SkCodec_libpng.h') diff --git a/src/codec/SkCodec_libpng.h b/src/codec/SkCodec_libpng.h index 297e8043fe..21bbdadb49 100644 --- a/src/codec/SkCodec_libpng.h +++ b/src/codec/SkCodec_libpng.h @@ -23,18 +23,18 @@ class SkStream; class SkPngCodec : public SkCodec { public: - // Assumes IsPng was called and returned true. - static SkCodec* NewFromStream(SkStream*); static bool IsPng(SkStream*); + // Assume IsPng was called and returned true. + static SkCodec* NewFromStream(SkStream*); + static SkScanlineDecoder* NewSDFromStream(SkStream*); + virtual ~SkPngCodec(); protected: Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMColor*, int*) override; SkEncodedFormat onGetEncodedFormat() const override { return kPNG_SkEncodedFormat; } - SkScanlineDecoder* onGetScanlineDecoder(const SkImageInfo& dstInfo, const Options& options, - SkPMColor ctable[], int* ctableCount) override; bool onReallyHasAlpha() const override { return fReallyHasAlpha; } private: png_structp fPng_ptr; -- cgit v1.2.3