Index: src/codec/SkSampler.h |
diff --git a/src/codec/SkSampler.h b/src/codec/SkSampler.h |
index 73e11c986e2949981a4f215678582fdfce060e8c..1a75d482fb7495e6b9c94ea37e5fd8a39fe2be73 100644 |
--- a/src/codec/SkSampler.h |
+++ b/src/codec/SkSampler.h |
@@ -21,6 +21,28 @@ 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 Zero-based index into the subset. |
+ */ |
+ bool rowNeeded(int row) const { |
+ return row % fSampleY == 0; |
msarett
2016/05/24 13:14:07
Is this correct? I think we don't start at row 0.
scroggo
2016/05/24 14:24:50
I believe it's used correctly by SkPngCodec, but i
msarett
2016/05/24 14:28:33
Gotcha thanks.
|
+ } |
+ |
+ /** |
* Fill the remainder of the destination with a single color |
* |
* @param info |
@@ -54,8 +76,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; |
}; |