diff options
author | msarett <msarett@google.com> | 2016-02-11 10:49:31 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-11 10:49:31 -0800 |
commit | f4004f9309242533dea68c95433020db71fc65c8 (patch) | |
tree | ec2f1652366a883c243c01a9760c6d6fb934708d /src/codec/SkBmpStandardCodec.cpp | |
parent | 17315c20e7a87d6e92fdc4623d2e27303037a051 (diff) |
Support more color types for ICOs
BUG=skia:4620
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1694513002
Review URL: https://codereview.chromium.org/1694513002
Diffstat (limited to 'src/codec/SkBmpStandardCodec.cpp')
-rw-r--r-- | src/codec/SkBmpStandardCodec.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/codec/SkBmpStandardCodec.cpp b/src/codec/SkBmpStandardCodec.cpp index 203e7da654..66a8c9a12a 100644 --- a/src/codec/SkBmpStandardCodec.cpp +++ b/src/codec/SkBmpStandardCodec.cpp @@ -17,7 +17,8 @@ SkBmpStandardCodec::SkBmpStandardCodec(const SkImageInfo& info, SkStream* stream, uint16_t bitsPerPixel, uint32_t numColors, uint32_t bytesPerColor, uint32_t offset, - SkCodec::SkScanlineOrder rowOrder, bool inIco) + SkCodec::SkScanlineOrder rowOrder, + bool isOpaque, bool inIco) : INHERITED(info, stream, bitsPerPixel, rowOrder) , fColorTable(nullptr) , fNumColors(numColors) @@ -26,6 +27,7 @@ SkBmpStandardCodec::SkBmpStandardCodec(const SkImageInfo& info, SkStream* stream , fSwizzler(nullptr) , fSrcRowBytes(SkAlign4(compute_row_bytes(this->getInfo().width(), this->bitsPerPixel()))) , fSrcBuffer(new uint8_t [fSrcRowBytes]) + , fIsOpaque(isOpaque) , fInIco(inIco) , fAndMaskRowBytes(fInIco ? SkAlign4(compute_row_bytes(this->getInfo().width(), 1)) : 0) {} @@ -94,8 +96,7 @@ SkCodec::Result SkBmpStandardCodec::onGetPixels(const SkImageInfo& dstInfo, // Choose the proper packing function SkPMColor (*packARGB) (uint32_t, uint32_t, uint32_t, uint32_t); - SkAlphaType encodedAlphaType = this->getInfo().alphaType(); - if (kOpaque_SkAlphaType == encodedAlphaType || kUnpremul_SkAlphaType == dstAlphaType) { + if (fIsOpaque || kUnpremul_SkAlphaType == dstAlphaType) { packARGB = &SkPackARGB32NoCheck; } else { packARGB = &SkPremultiplyARGBInline; @@ -108,7 +109,7 @@ SkCodec::Result SkBmpStandardCodec::onGetPixels(const SkImageInfo& dstInfo, uint8_t green = get_byte(cBuffer.get(), i*fBytesPerColor + 1); uint8_t red = get_byte(cBuffer.get(), i*fBytesPerColor + 2); uint8_t alpha; - if (kOpaque_SkAlphaType == encodedAlphaType) { + if (fIsOpaque) { alpha = 0xFF; } else { alpha = get_byte(cBuffer.get(), i*fBytesPerColor + 3); @@ -172,7 +173,7 @@ bool SkBmpStandardCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Op config = SkSwizzler::kBGR; break; case 32: - if (kOpaque_SkAlphaType == this->getInfo().alphaType()) { + if (fIsOpaque) { config = SkSwizzler::kBGRX; } else { config = SkSwizzler::kBGRA; |