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

Unified Diff: src/codec/SkBmpRLECodec.cpp

Issue 1287423002: Scanline decoding for bmp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Response to comments - Does not compile - Needs rebase for conv_poss update Created 5 years, 4 months 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
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;
+}

Powered by Google App Engine
This is Rietveld 408576698