Chromium Code Reviews| Index: src/codec/SkSampler.h |
| diff --git a/src/codec/SkSampler.h b/src/codec/SkSampler.h |
| index b233c32be22942577fb4502c7e722662417c2b82..00015585a11dda1fcf74e9ecc02ad9bec7f58662 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; |
|
msarett
2016/09/14 18:16:05
I actually think for this to work properly, it dep
scroggo_chromium
2016/09/14 22:01:41
Agreed. I think the comment describes that? ("star
|
| + } |
| + |
| + /** |
| * Fill the remainder of the destination with a single color |
| * |
| * @param info |
| @@ -55,8 +79,13 @@ public: |
| virtual void fill(const SkImageInfo& info, void* dst, size_t rowBytes, |
| uint64_t colorOrIndex, SkCodec::ZeroInitialized zeroInit) {} |
| + SkSampler() |
| + : fSampleY(1) |
| + {} |
| + |
| virtual ~SkSampler() {} |
| private: |
| + int fSampleY; |
| virtual int onSetSampleX(int) = 0; |
| }; |