Index: src/codec/SkBmpRLECodec.cpp |
diff --git a/src/codec/SkBmpRLECodec.cpp b/src/codec/SkBmpRLECodec.cpp |
index c71a5409d2c2c2ee5d2fa11261594c809f4c66d1..4d7a66373472762dba1b61d22cc3ca17264ec665 100644 |
--- a/src/codec/SkBmpRLECodec.cpp |
+++ b/src/codec/SkBmpRLECodec.cpp |
@@ -45,10 +45,11 @@ static bool conversion_possible(const SkImageInfo& dst, |
* Called only by NewFromStream |
*/ |
SkBmpRLECodec::SkBmpRLECodec(const SkImageInfo& info, SkStream* stream, |
+ SkBmpCodec::BmpInputFormat inputFormat, |
uint16_t bitsPerPixel, uint32_t numColors, |
uint32_t bytesPerColor, uint32_t offset, |
SkBmpCodec::RowOrder rowOrder, size_t RLEBytes) |
- : INHERITED(info, stream, bitsPerPixel, rowOrder) |
+ : INHERITED(info, stream, inputFormat, bitsPerPixel, rowOrder) |
, fColorTable(NULL) |
, fNumColors(this->computeNumColors(numColors)) |
, fBytesPerColor(bytesPerColor) |
@@ -475,3 +476,24 @@ SkCodec::Result SkBmpRLECodec::decode(const SkImageInfo& dstInfo, |
} |
} |
} |
+ |
+SkCodec::Result SkBmpRLECodec::onStart(const SkImageInfo& dstInfo, |
+ const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputColorCount) { |
+ // Create the color table if necessary and prepare the stream for decode |
+ // Note that if it is non-NULL, inputColorCount will be modified |
+ if (!this->createColorTable(inputColorCount)) { |
+ SkCodecPrintf("Error: could not create color table.\n"); |
+ return SkCodec::kInvalidInput; |
+ } |
+ |
+ // Copy the color table to the client if necessary |
+ copy_color_table(dstInfo, this->fColorTable, inputColorPtr, inputColorCount); |
+ |
+ // Initialize a buffer for encoded RLE data |
+ if (!this->initializeStreamBuffer()) { |
+ SkCodecPrintf("Error: cannot initialize swizzler.\n"); |
+ return SkCodec::kInvalidConversion; |
+ } |
+ |
+ return SkCodec::kSuccess; |
+} |