Index: src/codec/SkSampledCodec.cpp |
diff --git a/src/codec/SkSampledCodec.cpp b/src/codec/SkSampledCodec.cpp |
index d5fbd0fa520615a4a750674ea792bb199b7bdfb9..00bdce4c8b577731921df3fc7ba5819951a6998d 100644 |
--- a/src/codec/SkSampledCodec.cpp |
+++ b/src/codec/SkSampledCodec.cpp |
@@ -226,6 +226,43 @@ SkCodec::Result SkSampledCodec::sampledDecode(const SkImageInfo& info, void* pix |
} |
return SkCodec::kSuccess; |
} |
+ case SkCodec::kBottomUp_SkScanlineOrder: { |
+ // Note that this mode does not support subsetting. |
+ SkASSERT(0 == subsetY && nativeSize.height() == subsetHeight); |
+ int y; |
+ for (y = 0; y < nativeSize.height(); y++) { |
+ int srcY = fCodec->nextScanline(); |
+ if (is_coord_necessary(srcY, sampleY, dstHeight)) { |
+ void* pixelPtr = SkTAddOffset<void>(pixels, |
+ rowBytes * get_dst_coord(srcY, sampleY)); |
+ if (1 != fCodec->getScanlines(pixelPtr, 1, rowBytes)) { |
+ break; |
+ } |
+ } else { |
+ if (!fCodec->skipScanlines(1)) { |
+ break; |
+ } |
+ } |
+ } |
+ |
+ if (nativeSize.height() == y) { |
+ return SkCodec::kSuccess; |
scroggo
2015/11/17 16:13:58
nit: four space indent
(Joke's on you for copying
msarett
2015/11/17 16:24:27
:). Not the first time I've fallen for this.
|
+ } |
+ |
+ // We handle filling uninitialized memory here instead of using fCodec. |
+ // fCodec does not know that we are sampling. |
+ const uint32_t fillValue = fCodec->getFillValue(info.colorType(), info.alphaType()); |
+ for (; y < nativeSize.height(); y++) { |
+ int srcY = fCodec->outputScanline(y); |
+ if (is_coord_necessary(srcY, sampleY, dstHeight)) { |
scroggo
2015/11/17 16:13:58
nit: You could give yourself a little extra width
msarett
2015/11/17 16:24:27
sgtm
|
+ void* pixelPtr = SkTAddOffset<void>(pixels, |
+ rowBytes * get_dst_coord(srcY, sampleY)); |
+ SkSampler::Fill(info.makeWH(info.width(), 1), pixelPtr, rowBytes, fillValue, |
scroggo
2015/11/17 16:13:58
nit: I think you should create this info once outs
msarett
2015/11/17 16:24:27
Done.
|
+ options.fZeroInitialized); |
+ } |
+ } |
+ return SkCodec::kIncompleteInput; |
+ } |
case SkCodec::kNone_SkScanlineOrder: { |
const int linesNeeded = subsetHeight - samplingOffsetY; |
SkAutoMalloc storage(linesNeeded * rowBytes); |