Chromium Code Reviews| Index: src/codec/SkScaledCodec.cpp |
| diff --git a/src/codec/SkScaledCodec.cpp b/src/codec/SkScaledCodec.cpp |
| index a9e067eaaf6f07a0ba553436f2bda13d7fa0179b..5027d52f88242e160ddcb245895179cb959f3430 100644 |
| --- a/src/codec/SkScaledCodec.cpp |
| +++ b/src/codec/SkScaledCodec.cpp |
| @@ -44,15 +44,6 @@ SkScaledCodec::SkScaledCodec(SkScanlineDecoder* scanlineDecoder) |
| SkScaledCodec::~SkScaledCodec() {} |
| -// returns a scaled dimension based on the original dimension and the sampleSize |
| -// NOTE: we round down here for scaled dimension to match the behavior of SkImageDecoder |
| -static int get_scaled_dimension(int srcDimension, int sampleSize) { |
| - if (sampleSize > srcDimension) { |
| - return 1; |
| - } |
| - return srcDimension / sampleSize; |
| -} |
| - |
| static SkISize best_scaled_dimensions(const SkISize& origDims, const SkISize& nativeDims, |
| const SkISize& scaledCodecDims, float desiredScale) { |
| if (nativeDims == scaledCodecDims) { |
| @@ -197,7 +188,23 @@ SkCodec::Result SkScaledCodec::onGetPixels(const SkImageInfo& requestedInfo, voi |
| Result result = fScanlineDecoder->start(requestedInfo, &options, ctable, ctableCount); |
| if (kSuccess == result) { |
| // native decode supported |
| - return fScanlineDecoder->getScanlines(dst, requestedInfo.height(), rowBytes); |
| + switch (fScanlineDecoder->getScanlineOrder()) { |
| + case SkScanlineDecoder::kTopDown_SkScanlineOrder: |
| + case SkScanlineDecoder::kBottomUp_SkScanlineOrder: |
| + case SkScanlineDecoder::kNone_SkScanlineOrder: |
| + return fScanlineDecoder->getScanlines(dst, requestedInfo.height(), rowBytes); |
| + case SkScanlineDecoder::kOutOfOrder_SkScanlineOrder: { |
| + for (int y = 0; y < requestedInfo.height(); y++) { |
| + int dstY = fScanlineDecoder->getY(); |
| + void* dstPtr = SkTAddOffset<void>(dst, rowBytes * dstY); |
| + result = fScanlineDecoder->getScanlines(dstPtr, 1, rowBytes); |
| + if (kSuccess != result && kIncompleteInput != result) { |
|
scroggo
2015/09/02 22:45:48
Again, I am concerned about accepting kIncomplete
msarett
2015/09/03 17:13:31
I would agree that we should return result at the
scroggo
2015/09/04 18:42:09
I'm happy with a FIXME. I think I understand what'
msarett
2015/09/04 19:52:47
I think we can improve on this... FIXME sounds go
|
| + return result; |
| + } |
| + } |
| + return kSuccess; |
| + } |
| + } |
| } |
| if (kInvalidScale != result) { |