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

Unified Diff: src/codec/SkSampledCodec.cpp

Issue 1443783002: Make SkAndroidCodec support bmp (Closed) Base URL: https://skia.googlesource.com/skia.git@ship
Patch Set: Created 5 years, 1 month 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/SkAndroidCodec.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkSampledCodec.cpp
diff --git a/src/codec/SkSampledCodec.cpp b/src/codec/SkSampledCodec.cpp
index d5fbd0fa520615a4a750674ea792bb199b7bdfb9..bb7b067ce2946a13a097e76138021d109cc731e5 100644
--- a/src/codec/SkSampledCodec.cpp
+++ b/src/codec/SkSampledCodec.cpp
@@ -226,6 +226,45 @@ 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);
+ SkCodec::Result result = SkCodec::kSuccess;
+ 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)) {
+ result = SkCodec::kIncompleteInput;
scroggo 2015/11/17 15:33:17 This might be 6 of one, half a dozen of the other,
msarett 2015/11/17 16:06:24 I think this approach makes things a little cleare
+ break;
+ }
+ } else {
+ if (!fCodec->skipScanlines(1)) {
+ result = SkCodec::kIncompleteInput;
+ break;
+ }
+ }
+ }
+
+ // We handle filling uninitialized memory here instead of using fCodec.
+ // fCodec does not know that we are sampling.
+ if (SkCodec::kIncompleteInput == result) {
+ 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)) {
+ void* pixelPtr = SkTAddOffset<void>(pixels,
+ rowBytes * get_dst_coord(srcY, sampleY));
+ SkSampler::Fill(info.makeWH(info.width(), 1), pixelPtr, rowBytes, fillValue,
+ options.fZeroInitialized);
+ }
+ }
+ }
+ return result;
+ }
case SkCodec::kNone_SkScanlineOrder: {
const int linesNeeded = subsetHeight - samplingOffsetY;
SkAutoMalloc storage(linesNeeded * rowBytes);
« no previous file with comments | « src/codec/SkAndroidCodec.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698