Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Unified Diff: src/codec/SkIcoCodec.cpp

Issue 2044573002: Revert of Make SkPngCodec decode progressively. (Closed) Base URL: https://skia.googlesource.com/skia.git@foil
Patch Set: Rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codec/SkIcoCodec.h ('k') | src/codec/SkPngCodec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkIcoCodec.cpp
diff --git a/src/codec/SkIcoCodec.cpp b/src/codec/SkIcoCodec.cpp
index abcf4dc7d2af88e80c7e690adf37c81bd92f7e54..0e81b72407218778b9d469e72b95941149b83309 100644
--- a/src/codec/SkIcoCodec.cpp
+++ b/src/codec/SkIcoCodec.cpp
@@ -186,7 +186,6 @@ SkIcoCodec::SkIcoCodec(int width, int height, const SkEncodedInfo& info,
: INHERITED(width, height, info, nullptr)
, fEmbeddedCodecs(codecs)
, fCurrScanlineCodec(nullptr)
- , fCurrIncrementalCodec(nullptr)
{}
/*
@@ -290,7 +289,6 @@ SkCodec::Result SkIcoCodec::onStartScanlineDecode(const SkImageInfo& dstInfo,
result = embeddedCodec->startScanlineDecode(dstInfo, &options, colorTable, colorCount);
if (kSuccess == result) {
fCurrScanlineCodec = embeddedCodec;
- fCurrIncrementalCodec = nullptr;
return result;
}
@@ -311,82 +309,13 @@ bool SkIcoCodec::onSkipScanlines(int count) {
return fCurrScanlineCodec->skipScanlines(count);
}
-SkCodec::Result SkIcoCodec::onStartIncrementalDecode(const SkImageInfo& dstInfo,
- void* pixels, size_t rowBytes, const SkCodec::Options& options,
- SkPMColor* colorTable, int* colorCount) {
- int index = 0;
- while (true) {
- index = this->chooseCodec(dstInfo.dimensions(), index);
- if (index < 0) {
- break;
- }
-
- SkCodec* embeddedCodec = fEmbeddedCodecs->operator[](index);
- switch (embeddedCodec->startIncrementalDecode(dstInfo,
- pixels, rowBytes, &options, colorTable, colorCount)) {
- case kSuccess:
- fCurrIncrementalCodec = embeddedCodec;
- fCurrScanlineCodec = nullptr;
- return kSuccess;
- case kUnimplemented:
- // FIXME: embeddedCodec is a BMP. If scanline decoding would work,
- // return kUnimplemented so that SkSampledCodec will fall through
- // to use the scanline decoder.
- // Note that calling startScanlineDecode will require an extra
- // rewind. The embedded codec has an SkMemoryStream, which is
- // cheap to rewind, though it will do extra work re-reading the
- // header.
- // Also note that we pass nullptr for Options. This is because
- // Options that are valid for incremental decoding may not be
- // valid for scanline decoding.
- // Once BMP supports incremental decoding this workaround can go
- // away.
- if (embeddedCodec->startScanlineDecode(dstInfo, nullptr,
- colorTable, colorCount) == kSuccess) {
- return kUnimplemented;
- }
- // Move on to the next embedded codec.
- break;
- default:
- break;
- }
-
- index++;
- }
-
- SkCodecPrintf("Error: No matching candidate image in ico.\n");
- return kInvalidScale;
-}
-
-SkCodec::Result SkIcoCodec::onIncrementalDecode(int* rowsDecoded) {
- SkASSERT(fCurrIncrementalCodec);
- return fCurrIncrementalCodec->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();
- }
-
- return INHERITED::onGetScanlineOrder();
+ // before startScanlineDecode().
+ return fCurrScanlineCodec ? fCurrScanlineCodec->getScanlineOrder() :
+ INHERITED::onGetScanlineOrder();
}
SkSampler* SkIcoCodec::getSampler(bool createIfNecessary) {
- if (fCurrScanlineCodec) {
- SkASSERT(!fCurrIncrementalCodec);
- return fCurrScanlineCodec->getSampler(createIfNecessary);
- }
-
- if (fCurrIncrementalCodec) {
- return fCurrIncrementalCodec->getSampler(createIfNecessary);
- }
-
- return nullptr;
+ return fCurrScanlineCodec ? fCurrScanlineCodec->getSampler(createIfNecessary) : nullptr;
}
« no previous file with comments | « src/codec/SkIcoCodec.h ('k') | src/codec/SkPngCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698