diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/codec/SkIcoCodec.cpp | 39 | ||||
-rw-r--r-- | src/codec/SkIcoCodec.h | 16 |
2 files changed, 15 insertions, 40 deletions
diff --git a/src/codec/SkIcoCodec.cpp b/src/codec/SkIcoCodec.cpp index 2936b1a9ea..74affe6709 100644 --- a/src/codec/SkIcoCodec.cpp +++ b/src/codec/SkIcoCodec.cpp @@ -204,8 +204,7 @@ SkIcoCodec::SkIcoCodec(int width, int height, const SkEncodedInfo& info, : INHERITED(width, height, info, SkColorSpaceXform::ColorFormat(), nullptr, std::move(colorSpace)) , fEmbeddedCodecs(codecs) - , fCurrScanlineCodec(nullptr) - , fCurrIncrementalCodec(nullptr) + , fCurrCodec(nullptr) {} /* @@ -306,8 +305,7 @@ SkCodec::Result SkIcoCodec::onStartScanlineDecode(const SkImageInfo& dstInfo, SkCodec* embeddedCodec = fEmbeddedCodecs->operator[](index).get(); result = embeddedCodec->startScanlineDecode(dstInfo, &options); if (kSuccess == result) { - fCurrScanlineCodec = embeddedCodec; - fCurrIncrementalCodec = nullptr; + fCurrCodec = embeddedCodec; return result; } @@ -319,13 +317,13 @@ SkCodec::Result SkIcoCodec::onStartScanlineDecode(const SkImageInfo& dstInfo, } int SkIcoCodec::onGetScanlines(void* dst, int count, size_t rowBytes) { - SkASSERT(fCurrScanlineCodec); - return fCurrScanlineCodec->getScanlines(dst, count, rowBytes); + SkASSERT(fCurrCodec); + return fCurrCodec->getScanlines(dst, count, rowBytes); } bool SkIcoCodec::onSkipScanlines(int count) { - SkASSERT(fCurrScanlineCodec); - return fCurrScanlineCodec->skipScanlines(count); + SkASSERT(fCurrCodec); + return fCurrCodec->skipScanlines(count); } SkCodec::Result SkIcoCodec::onStartIncrementalDecode(const SkImageInfo& dstInfo, @@ -341,8 +339,7 @@ SkCodec::Result SkIcoCodec::onStartIncrementalDecode(const SkImageInfo& dstInfo, switch (embeddedCodec->startIncrementalDecode(dstInfo, pixels, rowBytes, &options)) { case kSuccess: - fCurrIncrementalCodec = embeddedCodec; - fCurrScanlineCodec = nullptr; + fCurrCodec = embeddedCodec; return kSuccess; case kUnimplemented: // FIXME: embeddedCodec is a BMP. If scanline decoding would work, @@ -374,33 +371,23 @@ SkCodec::Result SkIcoCodec::onStartIncrementalDecode(const SkImageInfo& dstInfo, } SkCodec::Result SkIcoCodec::onIncrementalDecode(int* rowsDecoded) { - SkASSERT(fCurrIncrementalCodec); - return fCurrIncrementalCodec->incrementalDecode(rowsDecoded); + SkASSERT(fCurrCodec); + return fCurrCodec->incrementalDecode(rowsDecoded); } SkCodec::SkScanlineOrder SkIcoCodec::onGetScanlineOrder() const { // FIXME: This function will possibly return the wrong value if it is called // before startScanlineDecode()/startIncrementalDecode(). - if (fCurrScanlineCodec) { - SkASSERT(!fCurrIncrementalCodec); - return fCurrScanlineCodec->getScanlineOrder(); - } - - if (fCurrIncrementalCodec) { - return fCurrIncrementalCodec->getScanlineOrder(); + if (fCurrCodec) { + return fCurrCodec->getScanlineOrder(); } return INHERITED::onGetScanlineOrder(); } SkSampler* SkIcoCodec::getSampler(bool createIfNecessary) { - if (fCurrScanlineCodec) { - SkASSERT(!fCurrIncrementalCodec); - return fCurrScanlineCodec->getSampler(createIfNecessary); - } - - if (fCurrIncrementalCodec) { - return fCurrIncrementalCodec->getSampler(createIfNecessary); + if (fCurrCodec) { + return fCurrCodec->getSampler(createIfNecessary); } return nullptr; diff --git a/src/codec/SkIcoCodec.h b/src/codec/SkIcoCodec.h index 0b77df57c6..06ddeba9b4 100644 --- a/src/codec/SkIcoCodec.h +++ b/src/codec/SkIcoCodec.h @@ -92,21 +92,9 @@ private: std::unique_ptr<SkTArray<std::unique_ptr<SkCodec>, true>> fEmbeddedCodecs; - // Only used by the scanline decoder. onStartScanlineDecode() will set - // fCurrScanlineCodec to one of the fEmbeddedCodecs, if it can find a - // codec of the appropriate size. We will use fCurrScanlineCodec for - // subsequent calls to onGetScanlines() or onSkipScanlines(). - // fCurrScanlineCodec is owned by this class, but should not be an + // fCurrCodec is owned by this class, but should not be an // std::unique_ptr. It will be deleted by the destructor of fEmbeddedCodecs. - SkCodec* fCurrScanlineCodec; - - // Only used by incremental decoder. onStartIncrementalDecode() will set - // fCurrIncrementalCodec to one of the fEmbeddedCodecs, if it can find a - // codec of the appropriate size. We will use fCurrIncrementalCodec for - // subsequent calls to incrementalDecode(). - // fCurrIncrementalCodec is owned by this class, but should not be an - // std::unique_ptr. It will be deleted by the destructor of fEmbeddedCodecs. - SkCodec* fCurrIncrementalCodec; + SkCodec* fCurrCodec; typedef SkCodec INHERITED; }; |