Index: src/codec/SkBmpMaskCodec.cpp |
diff --git a/src/codec/SkBmpMaskCodec.cpp b/src/codec/SkBmpMaskCodec.cpp |
index 1c89ba1c84de158d80efa8725aebeef6d6b6c68c..daedbac166ba0530fff9ce73f716e155e80b4569 100644 |
--- a/src/codec/SkBmpMaskCodec.cpp |
+++ b/src/codec/SkBmpMaskCodec.cpp |
@@ -46,10 +46,9 @@ SkCodec::Result SkBmpMaskCodec::onGetPixels(const SkImageInfo& dstInfo, |
return kInvalidConversion; |
} |
- // Initialize a the mask swizzler |
- if (!this->initializeSwizzler(dstInfo)) { |
- SkCodecPrintf("Error: cannot initialize swizzler.\n"); |
- return kInvalidConversion; |
+ Result result = this->prepareToDecode(dstInfo, opts, inputColorPtr, inputColorCount); |
+ if (kSuccess != result) { |
+ return result; |
} |
return this->decode(dstInfo, dst, dstRowBytes, opts); |
@@ -100,7 +99,7 @@ SkCodec::Result SkBmpMaskCodec::decode(const SkImageInfo& dstInfo, |
} |
// Decode the row in destination format |
- int row = SkBmpCodec::kBottomUp_RowOrder == this->rowOrder() ? height - 1 - y : y; |
+ uint32_t row = this->getDstRow(y); |
void* dstRow = SkTAddOffset<void>(dst, row * dstRowBytes); |
fMaskSwizzler->swizzle(dstRow, srcRow); |
} |
@@ -108,3 +107,14 @@ SkCodec::Result SkBmpMaskCodec::decode(const SkImageInfo& dstInfo, |
// Finished decoding the entire image |
return kSuccess; |
} |
+ |
+SkCodec::Result SkBmpMaskCodec::prepareToDecode(const SkImageInfo& dstInfo, |
+ const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputColorCount) { |
+ // Initialize a the mask swizzler |
+ if (!this->initializeSwizzler(dstInfo)) { |
+ SkCodecPrintf("Error: cannot initialize swizzler.\n"); |
+ return SkCodec::kInvalidConversion; |
+ } |
+ |
+ return SkCodec::kSuccess; |
+} |