aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkBmpRLECodec.h
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@google.com>2015-10-02 13:14:46 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-10-02 13:14:46 -0700
commite7fc14b55bb8c41ba054abf0bfa09cdd6ec84671 (patch)
tree81525743c2c436a60f4127cf04f0f96d5dc3bed5 /src/codec/SkBmpRLECodec.h
parent65f7c9fa7ed028159a4a2c792ccc1dcdf718eed2 (diff)
Move all knowledge of X sampling into SkScaledCodec
Prior to this CL, each SkCodec subclass that allows sampling does an extra check in onStartScanlineDecode to determine whether the X dimension is supported for sampling. Remove this check, and provide a way for SkScaledCodec to directly access the SkSwizzler, and update it to do sampling. This way, the SkCodec knows nothing of sampling, but we can still save the extra step of sampling afterwards. FIXME: SkBmpRLECodec still calls SkScaledCodec::DimensionsSupported. It seems like it could directly support sampling, rather than dealing with SkScaledCodec (partially). Add a new base class for SkSwizzler. It allows updating the swizzler after it was created, which is done by SkScaledCodec. Modify SkSwizzler's constructor/factory function to stop taking any info about sampling, assume the sample size is one, and move modifying that into a virtual function overridden from the base class. BUG=skia:4284 Review URL: https://codereview.chromium.org/1372973002
Diffstat (limited to 'src/codec/SkBmpRLECodec.h')
-rw-r--r--src/codec/SkBmpRLECodec.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/codec/SkBmpRLECodec.h b/src/codec/SkBmpRLECodec.h
index ea2c2b6bab..8721969a85 100644
--- a/src/codec/SkBmpRLECodec.h
+++ b/src/codec/SkBmpRLECodec.h
@@ -8,6 +8,7 @@
#include "SkBmpCodec.h"
#include "SkColorTable.h"
#include "SkImageInfo.h"
+#include "SkSampler.h"
#include "SkTypes.h"
/*
@@ -39,6 +40,8 @@ public:
uint32_t offset, SkCodec::SkScanlineOrder rowOrder,
size_t RLEBytes);
+ int setSampleX(int);
+
protected:
Result onGetPixels(const SkImageInfo& dstInfo, void* dst,
@@ -84,6 +87,8 @@ private:
Result decodeRows(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes,
const Options& opts) override;
+ SkSampler* getSampler() override;
+
SkAutoTUnref<SkColorTable> fColorTable; // owned
const uint32_t fNumColors;
const uint32_t fBytesPerColor;
@@ -92,6 +97,7 @@ private:
size_t fRLEBytes;
uint32_t fCurrRLEByte;
int fSampleX;
+ SkAutoTDelete<SkSampler> fSampler;
typedef SkBmpCodec INHERITED;
};