| Index: src/codec/SkCodec_libpng.cpp
|
| diff --git a/src/codec/SkCodec_libpng.cpp b/src/codec/SkCodec_libpng.cpp
|
| index 9f9c110cc68bcc06ed9d38c7c272cdecea42341a..66d9b2cad2c5dd1da4a131a339a4f3b7a2f0a72f 100644
|
| --- a/src/codec/SkCodec_libpng.cpp
|
| +++ b/src/codec/SkCodec_libpng.cpp
|
| @@ -11,6 +11,7 @@
|
| #include "SkColorTable.h"
|
| #include "SkBitmap.h"
|
| #include "SkMath.h"
|
| +#include "SkScaledCodec.h"
|
| #include "SkScanlineDecoder.h"
|
| #include "SkSize.h"
|
| #include "SkStream.h"
|
| @@ -473,7 +474,7 @@ SkCodec::Result SkPngCodec::initializeSwizzler(const SkImageInfo& requestedInfo,
|
| // Create the swizzler. SkPngCodec retains ownership of the color table.
|
| const SkPMColor* colors = fColorTable ? fColorTable->readColors() : NULL;
|
| fSwizzler.reset(SkSwizzler::CreateSwizzler(fSrcConfig, colors, requestedInfo,
|
| - options.fZeroInitialized));
|
| + options.fZeroInitialized, this->getInfo().width()));
|
| if (!fSwizzler) {
|
| // FIXME: CreateSwizzler could fail for another reason.
|
| return kUnimplemented;
|
| @@ -599,7 +600,7 @@ public:
|
| , fCodec(codec)
|
| , fHasAlpha(false)
|
| {
|
| - fStorage.reset(dstInfo.width() * SkSwizzler::BytesPerPixel(fCodec->fSrcConfig));
|
| + fStorage.reset(fCodec->getInfo().width() * SkSwizzler::BytesPerPixel(fCodec->fSrcConfig));
|
| fSrcRow = static_cast<uint8_t*>(fStorage.get());
|
| }
|
|
|
| @@ -655,7 +656,7 @@ public:
|
| , fCurrentRow(0)
|
| , fHeight(dstInfo.height())
|
| {
|
| - fSrcRowBytes = dstInfo.width() * SkSwizzler::BytesPerPixel(fCodec->fSrcConfig);
|
| + fSrcRowBytes = codec->getInfo().width() * SkSwizzler::BytesPerPixel(fCodec->fSrcConfig);
|
| fGarbageRow.reset(fSrcRowBytes);
|
| fGarbageRowPtr = static_cast<uint8_t*>(fGarbageRow.get());
|
| }
|
| @@ -710,6 +711,10 @@ public:
|
|
|
| bool onReallyHasAlpha() const override { return fHasAlpha; }
|
|
|
| + bool onRequiresPostYSampling() override {
|
| + return true;
|
| + }
|
| +
|
| private:
|
| SkAutoTDelete<SkPngCodec> fCodec;
|
| bool fHasAlpha;
|
| @@ -731,7 +736,9 @@ SkScanlineDecoder* SkPngCodec::onGetScanlineDecoder(const SkImageInfo& dstInfo,
|
| }
|
| // Check to see if scaling was requested.
|
| if (dstInfo.dimensions() != this->getInfo().dimensions()) {
|
| - return NULL;
|
| + if (!SkScaledCodec::DimensionsSupportedForSampling(this->getInfo(), dstInfo)) {
|
| + return NULL;
|
| + }
|
| }
|
| // Create a new SkPngCodec, to be owned by the scanline decoder.
|
| SkStream* stream = this->stream()->duplicate();
|
|
|