diff options
author | nagarajan.n <nagarajan.n@samsung.com> | 2017-09-25 18:13:06 +0530 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-25 19:01:50 +0000 |
commit | 477e9d432abd157f52d40ee1aa10263793489d53 (patch) | |
tree | 2bdec00ecd4363a9f02dcdb15f5b9a241735ecad /src/codec | |
parent | f60c1a3ef905dc034dfcc91267fea382f77acea6 (diff) |
Merge fCurrIncrementalCodec and fCurrScanlineCodec usage into single
variable
This patch merges fCurrIncrementalCodec and fCurrScanlineCodec usage
into single variable for SkIcoCodec.
Bug: skia: None
Change-Id: I6629f04fc27b8792c4cb1e6f494f8df7006c6b21
Reviewed-on: https://skia-review.googlesource.com/50520
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'src/codec')
-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; }; |