aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/codec
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2015-08-14 06:37:37 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-14 06:37:37 -0700
commitb0a32cc38fcd8f37a23dfa19e928aeca529eaf14 (patch)
tree27b24eee017e5e6d621789df6e4bc55db7ce695c /include/codec
parent2ba70995f8a69285dd35968aa3a3e19d5429bdd0 (diff)
Revert of SkScaledCodec class (patchset #35 id:680001 of https://codereview.chromium.org/1260673002/ )
Reason for revert: breaking ubuntu bots Original issue's description: > SkScaledCodec class > > This class does scaling by using a scanlineDecoder. > getScanlines and skipScanlines are used for y sampling, > the swizzler is used for x sampling > > this class is currently only working for png and jpeg images > I will update other Codec types to work soon > > For SkJpegCodec to implement width wise swizzling it now > uses a swizzler. I ran performance tests on this change. > Here are the performance test results: > https://docs.google.com/a/google.com/spreadsheets/d/1D7-Q_GXD_dI68LZO005NNvb8Wq2Ee0wEBEPG72671yw/edit?usp=sharing > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/0944100ac89f797714eeae0cf2875e2335ff52ee > > Committed: https://skia.googlesource.com/skia/+/d518ea7927f9f4e0ed5b4134d1b4f48243855a47 > > Committed: https://skia.googlesource.com/skia/+/b157917507d4f7d2651f0aeb566d31603cc02240 TBR=scroggo@google.com,msarett@google.com,djsollen@google.com,mtklein@google.com,emmaleer@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1285173003
Diffstat (limited to 'include/codec')
-rw-r--r--include/codec/SkCodec.h2
-rw-r--r--include/codec/SkScaledCodec.h70
-rw-r--r--include/codec/SkScanlineDecoder.h42
3 files changed, 0 insertions, 114 deletions
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h
index 3465c1df5b..a0bd18a8e5 100644
--- a/include/codec/SkCodec.h
+++ b/include/codec/SkCodec.h
@@ -51,8 +51,6 @@ public:
* Return a size that approximately supports the desired scale factor.
* The codec may not be able to scale efficiently to the exact scale
* factor requested, so return a size that approximates that scale.
- * The returned value is the codec's suggestion for the closest valid
- * scale that it can natively support
*/
SkISize getScaledDimensions(float desiredScale) const {
return this->onGetScaledDimensions(desiredScale);
diff --git a/include/codec/SkScaledCodec.h b/include/codec/SkScaledCodec.h
deleted file mode 100644
index 1bcdf085b2..0000000000
--- a/include/codec/SkScaledCodec.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#ifndef SkScaledCodec_DEFINED
-#define SkScaledCodec_DEFINED
-
-#include "SkCodec.h"
-#include "SkScanlineDecoder.h"
-
-class SkScanlineDecoder;
-class SkStream;
-
-/**
- * This class implements scaling, by sampling scanlines in the y direction.
- * x-wise sampling is implemented in the swizzler, when getScanlines() is called.
- */
-class SkScaledCodec : public SkCodec {
-public:
- static SkCodec* NewFromStream(SkStream*);
- static SkCodec* NewFromData(SkData*);
-
- virtual ~SkScaledCodec();
-
- /**
- * returns whether a destination's dimensions are supported for down sampling
- */
- static bool DimensionsSupportedForSampling(const SkImageInfo& srcInfo,
- const SkImageInfo& dstInfo) {
- // heights must be equal as no native y sampling is supported
- if (dstInfo.height() != srcInfo.height()) {
- return false;
- }
- // only support down sampling, dstWidth cannot be larger that srcWidth
- if(dstInfo.width() > srcInfo.width()) {
- return false;
- }
- return true;
- }
-
- static void ComputeSampleSize(const SkImageInfo& dstInfo, const SkImageInfo& srcInfo,
- int* sampleSizeX, int* sampleSizeY);
-
-protected:
- /**
- * Recommend a set of destination dimensions given a requested scale
- */
- SkISize onGetScaledDimensions(float desiredScale) const override;
-
- Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMColor*, int*)
- override;
- SkEncodedFormat onGetEncodedFormat() const override {
- return fScanlineDecoder->getEncodedFormat();
- }
-
- bool onReallyHasAlpha() const override {
- return fScanlineDecoder->reallyHasAlpha();
- }
-
-private:
-
- SkAutoTDelete<SkScanlineDecoder> fScanlineDecoder;
-
- explicit SkScaledCodec(SkScanlineDecoder*);
-
- typedef SkCodec INHERITED;
-};
-#endif // SkScaledCodec_DEFINED
diff --git a/include/codec/SkScanlineDecoder.h b/include/codec/SkScanlineDecoder.h
index c547f6701f..c233663dbd 100644
--- a/include/codec/SkScanlineDecoder.h
+++ b/include/codec/SkScanlineDecoder.h
@@ -46,18 +46,6 @@ public:
virtual ~SkScanlineDecoder() {}
/**
- * Return a size that approximately supports the desired scale factor.
- * The codec may not be able to scale efficiently to the exact scale
- * factor requested, so return a size that approximates that scale.
- * The returned value is the codec's suggestion for the closest valid
- * scale that it can natively support
- * FIXME: share this with SkCodec
- */
- SkISize getScaledDimensions(float desiredScale) {
- return this->onGetScaledDimensions(desiredScale);
- }
-
- /**
* Returns the default info, corresponding to the encoded data.
*/
const SkImageInfo& getInfo() { return fSrcInfo; }
@@ -147,44 +135,14 @@ public:
return this->onReallyHasAlpha();
}
- /**
- * Format of the encoded data.
- */
- SkEncodedFormat getEncodedFormat() const { return this->onGetEncodedFormat(); }
-
- /**
- * returns true if the image must be scaled, in the y direction, after reading, not during.
- * To scale afterwards, we first decode every line and then sample the lines we want afterwards.
- * An example is interlaced pngs, where calling getScanlines once (regardless of the count
- * used) needs to read the entire image, therefore it is inefficient to call
- * getScanlines more than once. Instead, it should only ever be called with all the
- * rows needed.
- */
- bool requiresPostYSampling() {
- return this->onRequiresPostYSampling();
- }
-
protected:
SkScanlineDecoder(const SkImageInfo& srcInfo)
: fSrcInfo(srcInfo)
, fDstInfo()
, fCurrScanline(0) {}
- virtual SkISize onGetScaledDimensions(float /* desiredScale */) {
- // By default, scaling is not supported.
- return this->getInfo().dimensions();
- }
-
- virtual SkEncodedFormat onGetEncodedFormat() const = 0;
-
virtual bool onReallyHasAlpha() const { return false; }
- /**
- * returns true if the image type is hard to sample and must be scaled after reading, not during
- * An example is interlaced pngs, where the entire image must be read for each decode
- */
- virtual bool onRequiresPostYSampling() { return false; }
-
const SkImageInfo& dstInfo() const { return fDstInfo; }
private: