Index: dm/DMSrcSink.cpp |
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp |
index e31a249f70bcbf58eb340c7de3719c3b87e738f3..981e47d6c0bf84690c25c8a49392fa2e3abadc18 100644 |
--- a/dm/DMSrcSink.cpp |
+++ b/dm/DMSrcSink.cpp |
@@ -352,8 +352,28 @@ Error CodecSrc::draw(SkCanvas* canvas) const { |
return Error::Nonfatal("Could not start scanline decoder"); |
} |
- const SkCodec::Result result = scanlineDecoder->getScanlines( |
- bitmap.getAddr(0, 0), decodeInfo.height(), bitmap.rowBytes()); |
+ SkCodec::Result result = SkCodec::kUnimplemented; |
+ switch (scanlineDecoder->getScanlineOrder()) { |
+ case SkScanlineDecoder::kTopDown_SkScanlineOrder: |
+ case SkScanlineDecoder::kBottomUp_SkScanlineOrder: |
+ case SkScanlineDecoder::kNone_SkScanlineOrder: |
+ result = scanlineDecoder->getScanlines(bitmap.getAddr(0, 0), |
+ decodeInfo.height(), bitmap.rowBytes()); |
+ break; |
+ case SkScanlineDecoder::kOutOfOrder_SkScanlineOrder: { |
+ for (int y = 0; y < decodeInfo.height(); y++) { |
+ int dstY = scanlineDecoder->getY(); |
+ void* dstPtr = bitmap.getAddr(0, dstY); |
+ result = scanlineDecoder->getScanlines(dstPtr, 1, bitmap.rowBytes()); |
+ if (SkCodec::kSuccess != result && SkCodec::kIncompleteInput != result) { |
+ return SkStringPrintf("%s failed with error message %d", |
+ fPath.c_str(), (int) result); |
+ } |
+ } |
+ break; |
+ } |
+ } |
+ |
switch (result) { |
case SkCodec::kSuccess: |
case SkCodec::kIncompleteInput: |