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

Unified Diff: src/codec/SkBmpStandardCodec.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/SkBmpStandardCodec.cpp
diff --git a/src/codec/SkBmpStandardCodec.cpp b/src/codec/SkBmpStandardCodec.cpp
index 08146fc3e48f9a75f528044ade27e7fb497df13b..a4d296b8f560e18715dac67a7244a29acd66e75f 100644
--- a/src/codec/SkBmpStandardCodec.cpp
+++ b/src/codec/SkBmpStandardCodec.cpp
@@ -45,10 +45,11 @@ static bool conversion_possible(const SkImageInfo& dst,
* Called only by NewFromStream
*/
SkBmpStandardCodec::SkBmpStandardCodec(const SkImageInfo& info, SkStream* stream,
+ SkBmpCodec::BmpInputFormat inputFormat,
uint16_t bitsPerPixel, uint32_t numColors,
uint32_t bytesPerColor, uint32_t offset,
SkBmpCodec::RowOrder rowOrder, bool inIco)
- : INHERITED(info, stream, bitsPerPixel, rowOrder)
+ : INHERITED(info, stream, inputFormat, bitsPerPixel, rowOrder)
, fColorTable(NULL)
, fNumColors(this->computeNumColors(numColors))
, fBytesPerColor(bytesPerColor)
@@ -280,8 +281,8 @@ static uint32_t get_fill_color_or_index(uint16_t bitsPerPixels, SkAlphaType alph
* Performs the bitmap decoding for standard input format
*/
SkCodec::Result SkBmpStandardCodec::decode(const SkImageInfo& dstInfo,
- void* dst, size_t dstRowBytes,
- const Options& opts) {
+ void* dst, size_t dstRowBytes,
+ const Options& opts) {
// Set constant values
const int width = dstInfo.width();
const int height = dstInfo.height();
@@ -359,3 +360,24 @@ SkCodec::Result SkBmpStandardCodec::decode(const SkImageInfo& dstInfo,
// Finished decoding the entire image
return kSuccess;
}
+
+SkCodec::Result SkBmpStandardCodec::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(dstInfo.alphaType(), 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 swizzler if necessary
+ if (!this->initializeSwizzler(dstInfo, options)) {
+ SkCodecPrintf("Error: cannot initialize swizzler.\n");
+ return SkCodec::kInvalidConversion;
+ }
+
+ return SkCodec::kSuccess;
+}

Powered by Google App Engine
This is Rietveld 408576698