Chromium Code Reviews| Index: include/codec/SkScanlineDecoder.h |
| diff --git a/include/codec/SkScanlineDecoder.h b/include/codec/SkScanlineDecoder.h |
| index 8376e57c09d84bb48c1d7ae295ccd441a7feab48..d1cba35cce8da94fa6c0559b9f58a0970284f12a 100644 |
| --- a/include/codec/SkScanlineDecoder.h |
| +++ b/include/codec/SkScanlineDecoder.h |
| @@ -35,7 +35,7 @@ public: |
| */ |
| SkCodec::Result getScanlines(void* dst, int countLines, size_t rowBytes) { |
| if ((rowBytes < fDstInfo.minRowBytes() && countLines > 1 ) || countLines <= 0 |
| - || fCurrScanline + countLines > fDstInfo.height()) { |
| + || fCurrScanline + countLines > fSrcInfo.height()) { |
| return SkCodec::kInvalidParameters; |
| } |
| const SkCodec::Result result = this->onGetScanlines(dst, countLines, rowBytes); |
| @@ -52,7 +52,7 @@ public: |
| * false. |
| */ |
| SkCodec::Result skipScanlines(int countLines) { |
| - if (fCurrScanline + countLines > fDstInfo.height()) { |
| + if (fCurrScanline + countLines > fSrcInfo.height()) { |
| // Arguably, we could just skip the scanlines which are remaining, |
| // and return kSuccess. We choose to return invalid so the client |
| // can catch their bug. |
| @@ -75,18 +75,26 @@ public: |
| return this->onReallyHasAlpha(); |
| } |
| + bool setSampleX(int sampleX) { |
|
scroggo
2015/07/27 15:09:19
Please add comments explaining what this does.
emmaleer
2015/07/27 18:31:38
Acknowledged.
|
| + return this->onSetSampleX(sampleX); |
| + } |
| + |
| protected: |
| - SkScanlineDecoder(const SkImageInfo& requested) |
| + SkScanlineDecoder(const SkImageInfo& requested, const SkImageInfo src) |
|
scroggo
2015/07/27 15:09:19
This should be a const reference. That way we do n
emmaleer
2015/07/27 18:31:38
Acknowledged.
|
| : fDstInfo(requested) |
| - , fCurrScanline(0) {} |
| + , fCurrScanline(0) |
| + , fSrcInfo(src) {} |
| virtual bool onReallyHasAlpha() const { return false; } |
| + virtual bool onSetSampleX(int SampleX){ return false; } |
| + |
| const SkImageInfo& dstInfo() const { return fDstInfo; } |
| private: |
| const SkImageInfo fDstInfo; |
| int fCurrScanline; |
| + const SkImageInfo fSrcInfo; |
| // Naive default version just calls onGetScanlines on temp memory. |
| virtual SkCodec::Result onSkipScanlines(int countLines) { |