| Index: include/codec/SkScanlineDecoder.h
|
| diff --git a/include/codec/SkScanlineDecoder.h b/include/codec/SkScanlineDecoder.h
|
| index d7f73dda56f92ef4bccc7bc431282b43d05a05a0..009fbec3177af791dfe38e95de48a8af56591d87 100644
|
| --- a/include/codec/SkScanlineDecoder.h
|
| +++ b/include/codec/SkScanlineDecoder.h
|
| @@ -17,7 +17,9 @@ class SkScanlineDecoder : public SkNoncopyable {
|
| public:
|
| // Note for implementations: An SkScanlineDecoder will be deleted by (and
|
| // therefore *before*) its associated SkCodec, in case the order matters.
|
| - virtual ~SkScanlineDecoder() {}
|
| + virtual ~SkScanlineDecoder() {
|
| + this->onFinish();
|
| + }
|
|
|
| /**
|
| * Write the next countLines scanlines into dst.
|
| @@ -34,7 +36,7 @@ public:
|
| return SkImageGenerator::kInvalidParameters;
|
| }
|
| const SkImageGenerator::Result result = this->onGetScanlines(dst, countLines, rowBytes);
|
| - this->checkForFinish(countLines);
|
| + fCurrScanline += countLines;
|
| return result;
|
| }
|
|
|
| @@ -54,7 +56,7 @@ public:
|
| return SkImageGenerator::kInvalidParameters;
|
| }
|
| const SkImageGenerator::Result result = this->onSkipScanlines(countLines);
|
| - this->checkForFinish(countLines);
|
| + fCurrScanline += countLines;
|
| return result;
|
| }
|
|
|
| @@ -98,19 +100,11 @@ private:
|
| size_t rowBytes) = 0;
|
|
|
| /**
|
| - * Called after any set of scanlines read/skipped. Updates fCurrScanline,
|
| - * and, if we are at the end, calls onFinish().
|
| - */
|
| - void checkForFinish(int countLines) {
|
| - fCurrScanline += countLines;
|
| - if (fCurrScanline >= fDstInfo.height()) {
|
| - this->onFinish();
|
| - }
|
| - }
|
| -
|
| - /**
|
| - * This function will be called after reading/skipping all scanlines to do
|
| + * This function will be called after reading/skipping scanlines to do
|
| * any necessary cleanups.
|
| + * It is possible that not all scanlines will have been read/skipped when this
|
| + * function is called. In fact, in the case of subset decodes, it is likely
|
| + * that there will be scanlines at the bottom of the image that have been ignored.
|
| */
|
| virtual void onFinish() {} // Default does nothing.
|
| };
|
|
|