aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkSampler.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/codec/SkSampler.h')
-rw-r--r--src/codec/SkSampler.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/codec/SkSampler.h b/src/codec/SkSampler.h
index 73e11c986e..af6f48598c 100644
--- a/src/codec/SkSampler.h
+++ b/src/codec/SkSampler.h
@@ -21,6 +21,30 @@ public:
}
/**
+ * Update the sampler to sample every sampleY'th row.
+ */
+ void setSampleY(int sampleY) {
+ fSampleY = sampleY;
+ }
+
+ /**
+ * Retrieve the value set for sampleY.
+ */
+ int sampleY() const {
+ return fSampleY;
+ }
+
+ /**
+ * Based on fSampleY, return whether this row belongs in the output.
+ *
+ * @param row Row of the image, starting with the first row used in the
+ * output.
+ */
+ bool rowNeeded(int row) const {
+ return row % fSampleY == 0;
+ }
+
+ /**
* Fill the remainder of the destination with a single color
*
* @param info
@@ -54,8 +78,13 @@ public:
virtual void fill(const SkImageInfo& info, void* dst, size_t rowBytes,
uint32_t colorOrIndex, SkCodec::ZeroInitialized zeroInit) {}
+ SkSampler()
+ : fSampleY(1)
+ {}
+
virtual ~SkSampler() {}
private:
+ int fSampleY;
virtual int onSetSampleX(int) = 0;
};