From fdb47571a3b5e72469b67de44e32ac14d9352ab4 Mon Sep 17 00:00:00 2001 From: msarett Date: Tue, 13 Oct 2015 12:50:14 -0700 Subject: Add subsetting to SkScanlineDecoder This CL allows the SkScanlineDecoder to decode partial scanlines. This is a first step in efficiently implementing subsetting in SkScaledCodec. BUG=skia:4209 Review URL: https://codereview.chromium.org/1390213002 --- src/codec/SkCodec_libpng.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/codec/SkCodec_libpng.cpp') diff --git a/src/codec/SkCodec_libpng.cpp b/src/codec/SkCodec_libpng.cpp index e828e24999..7d41623a88 100644 --- a/src/codec/SkCodec_libpng.cpp +++ b/src/codec/SkCodec_libpng.cpp @@ -435,8 +435,7 @@ SkCodec::Result SkPngCodec::initializeSwizzler(const SkImageInfo& requestedInfo, // Create the swizzler. SkPngCodec retains ownership of the color table. const SkPMColor* colors = get_color_ptr(fColorTable.get()); - fSwizzler.reset(SkSwizzler::CreateSwizzler(fSrcConfig, colors, requestedInfo, - options.fZeroInitialized)); + fSwizzler.reset(SkSwizzler::CreateSwizzler(fSrcConfig, colors, requestedInfo, options)); if (!fSwizzler) { // FIXME: CreateSwizzler could fail for another reason. return kUnimplemented; @@ -477,8 +476,7 @@ SkCodec::Result SkPngCodec::onGetPixels(const SkImageInfo& requestedInfo, void* } // Note that ctable and ctableCount may be modified if there is a color table - const Result result = this->initializeSwizzler(requestedInfo, options, - ctable, ctableCount); + const Result result = this->initializeSwizzler(requestedInfo, options, ctable, ctableCount); if (result != kSuccess) { return result; } @@ -699,15 +697,14 @@ public: } Result onStartScanlineDecode(const SkImageInfo& dstInfo, const Options& options, - SkPMColor ctable[], int* ctableCount) override - { + SkPMColor ctable[], int* ctableCount) override { if (!conversion_possible(dstInfo, this->getInfo())) { return kInvalidConversion; } - const SkCodec::Result result = this->initializeSwizzler(dstInfo, options, ctable, - ctableCount); - if (result != SkCodec::kSuccess) { + const Result result = this->initializeSwizzler(dstInfo, options, ctable, + ctableCount); + if (result != kSuccess) { return result; } -- cgit v1.2.3