aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkCodec_libpng.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/codec/SkCodec_libpng.cpp')
-rw-r--r--src/codec/SkCodec_libpng.cpp33
1 files changed, 8 insertions, 25 deletions
diff --git a/src/codec/SkCodec_libpng.cpp b/src/codec/SkCodec_libpng.cpp
index 159aecd7ef..c94f371399 100644
--- a/src/codec/SkCodec_libpng.cpp
+++ b/src/codec/SkCodec_libpng.cpp
@@ -11,7 +11,6 @@
#include "SkColorTable.h"
#include "SkBitmap.h"
#include "SkMath.h"
-#include "SkScaledCodec.h"
#include "SkScanlineDecoder.h"
#include "SkSize.h"
#include "SkStream.h"
@@ -463,7 +462,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, this->getInfo()));
+ options.fZeroInitialized));
if (!fSwizzler) {
// FIXME: CreateSwizzler could fail for another reason.
return kUnimplemented;
@@ -583,7 +582,8 @@ public:
SkCodec::Result onStart(const SkImageInfo& dstInfo,
const SkCodec::Options& options,
- SkPMColor ctable[], int* ctableCount) override {
+ SkPMColor ctable[], int* ctableCount) override
+ {
if (!fCodec->rewindIfNeeded()) {
return SkCodec::kCouldNotRewind;
}
@@ -594,9 +594,7 @@ public:
// Check to see if scaling was requested.
if (dstInfo.dimensions() != this->getInfo().dimensions()) {
- if (!SkScaledCodec::DimensionsSupportedForSampling(this->getInfo(), dstInfo)) {
- return SkCodec::kInvalidScale;
- }
+ return SkCodec::kInvalidScale;
}
const SkCodec::Result result = fCodec->initializeSwizzler(dstInfo, options, ctable,
@@ -606,7 +604,7 @@ public:
}
fHasAlpha = false;
- fStorage.reset(this->getInfo().width() * SkSwizzler::BytesPerPixel(fCodec->fSrcConfig));
+ fStorage.reset(dstInfo.width() * SkSwizzler::BytesPerPixel(fCodec->fSrcConfig));
fSrcRow = static_cast<uint8_t*>(fStorage.get());
return SkCodec::kSuccess;
@@ -645,11 +643,6 @@ public:
bool onReallyHasAlpha() const override { return fHasAlpha; }
- SkEncodedFormat onGetEncodedFormat() const override {
- return kPNG_SkEncodedFormat;
- }
-
-
private:
SkAutoTDelete<SkPngCodec> fCodec;
bool fHasAlpha;
@@ -680,14 +673,12 @@ public:
}
if (!conversion_possible(dstInfo, this->getInfo())) {
- return SkCodec::kInvalidConversion;
+ return SkCodec::kInvalidConversion;
}
// Check to see if scaling was requested.
if (dstInfo.dimensions() != this->getInfo().dimensions()) {
- if (!SkScaledCodec::DimensionsSupportedForSampling(this->getInfo(), dstInfo)) {
- return SkCodec::kInvalidScale;
- }
+ return SkCodec::kInvalidScale;
}
const SkCodec::Result result = fCodec->initializeSwizzler(dstInfo, options, ctable,
@@ -699,7 +690,7 @@ public:
fHasAlpha = false;
fCurrentRow = 0;
fHeight = dstInfo.height();
- fSrcRowBytes = this->getInfo().width() * SkSwizzler::BytesPerPixel(fCodec->fSrcConfig);
+ fSrcRowBytes = dstInfo.width() * SkSwizzler::BytesPerPixel(fCodec->fSrcConfig);
fGarbageRow.reset(fSrcRowBytes);
fGarbageRowPtr = static_cast<uint8_t*>(fGarbageRow.get());
fCanSkipRewind = true;
@@ -762,14 +753,6 @@ public:
bool onReallyHasAlpha() const override { return fHasAlpha; }
- bool onRequiresPostYSampling() override {
- return true;
- }
-
- SkEncodedFormat onGetEncodedFormat() const override {
- return kPNG_SkEncodedFormat;
- }
-
private:
SkAutoTDelete<SkPngCodec> fCodec;
bool fHasAlpha;