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

Unified Diff: dm/DMSrcSink.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 | « no previous file | fuzz/fuzz.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMSrcSink.cpp
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 06abdceb4e390ebbf939d0cbf3266bd4ef3c3328..9927c30428b51a8442e62e9498e3bd4bd28dbac1 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -438,55 +438,31 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
break;
}
case kScanline_Mode: {
- void* dst = pixels.get();
- uint32_t height = decodeInfo.height();
- const bool png = fPath.endsWith("png");
- const bool ico = fPath.endsWith("ico");
- bool useOldScanlineMethod = !png && !ico;
- if (png || ico) {
- if (SkCodec::kSuccess == codec->startIncrementalDecode(decodeInfo, dst,
- rowBytes, nullptr, colorPtr, &colorCount)) {
- int rowsDecoded;
- if (SkCodec::kIncompleteInput == codec->incrementalDecode(&rowsDecoded)) {
- codec->fillIncompleteImage(decodeInfo, dst, rowBytes,
- SkCodec::kNo_ZeroInitialized, height,
- rowsDecoded);
- }
- } else {
- if (png) {
- // Error: PNG should support incremental decode.
- return "Could not start incremental decode";
- }
- // Otherwise, this is an ICO. Since incremental failed, it must contain a BMP,
- // which should work via startScanlineDecode
- useOldScanlineMethod = true;
- }
+ if (SkCodec::kSuccess != codec->startScanlineDecode(decodeInfo, NULL, colorPtr,
+ &colorCount)) {
+ return "Could not start scanline decoder";
}
- if (useOldScanlineMethod) {
- if (SkCodec::kSuccess != codec->startScanlineDecode(decodeInfo, NULL, colorPtr,
- &colorCount)) {
- return "Could not start scanline decoder";
- }
-
- switch (codec->getScanlineOrder()) {
- case SkCodec::kTopDown_SkScanlineOrder:
- case SkCodec::kBottomUp_SkScanlineOrder:
- // We do not need to check the return value. On an incomplete
- // image, memory will be filled with a default value.
- codec->getScanlines(dst, height, rowBytes);
- break;
- case SkCodec::kOutOfOrder_SkScanlineOrder: {
- for (int y = 0; y < decodeInfo.height(); y++) {
- int dstY = codec->outputScanline(y);
- void* dstPtr = SkTAddOffset<void>(dst, rowBytes * dstY);
- // We complete the loop, even if this call begins to fail
- // due to an incomplete image. This ensures any uninitialized
- // memory will be filled with the proper value.
- codec->getScanlines(dstPtr, 1, rowBytes);
- }
- break;
+ void* dst = pixels.get();
+ uint32_t height = decodeInfo.height();
+ switch (codec->getScanlineOrder()) {
+ case SkCodec::kTopDown_SkScanlineOrder:
+ case SkCodec::kBottomUp_SkScanlineOrder:
+ case SkCodec::kNone_SkScanlineOrder:
+ // We do not need to check the return value. On an incomplete
+ // image, memory will be filled with a default value.
+ codec->getScanlines(dst, height, rowBytes);
+ break;
+ case SkCodec::kOutOfOrder_SkScanlineOrder: {
+ for (int y = 0; y < decodeInfo.height(); y++) {
+ int dstY = codec->outputScanline(y);
+ void* dstPtr = SkTAddOffset<void>(dst, rowBytes * dstY);
+ // We complete the loop, even if this call begins to fail
+ // due to an incomplete image. This ensures any uninitialized
+ // memory will be filled with the proper value.
+ codec->getScanlines(dstPtr, 1, rowBytes);
}
+ break;
}
}
« no previous file with comments | « no previous file | fuzz/fuzz.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698