Chromium Code Reviews| Index: src/codec/SkCodec.cpp |
| diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp |
| index b076954adcbcef936a9d859a49b4af6b60ebb070..3e009b15331d7b17112569abb701dfcd93230e40 100644 |
| --- a/src/codec/SkCodec.cpp |
| +++ b/src/codec/SkCodec.cpp |
| @@ -11,6 +11,7 @@ |
| #include "SkColorSpace.h" |
| #include "SkData.h" |
| #include "SkGifCodec.h" |
| +#include "SkHalf.h" |
| #include "SkIcoCodec.h" |
| #include "SkJpegCodec.h" |
| #ifdef SK_HAS_PNG_LIBRARY |
| @@ -353,8 +354,24 @@ int SkCodec::onOutputScanline(int inputScanline) const { |
| } |
| } |
| +uint64_t SkCodec::onGetFillValue(const SkImageInfo& dstInfo) const { |
| + switch (dstInfo.colorType()) { |
| + case kRGBA_F16_SkColorType: { |
| + uint64_t transparentColor = 0; |
| + uint64_t opaqueColor = ((uint64_t) SK_Half1) << 48; |
|
scroggo
2016/09/13 15:03:16
Can these be constexpr?
msarett
2016/09/13 15:23:55
Yes, done.
|
| + return (kOpaque_SkAlphaType == fSrcInfo.alphaType()) ? opaqueColor : transparentColor; |
| + } |
| + default: { |
| + // This not only handles the kN32 case, but also k565, kGray8, kIndex8, since |
| + // the low bits are zeros. |
| + return (kOpaque_SkAlphaType == fSrcInfo.alphaType()) ? |
| + SK_ColorBLACK : SK_ColorTRANSPARENT; |
| + } |
| + } |
| +} |
| + |
| static void fill_proc(const SkImageInfo& info, void* dst, size_t rowBytes, |
| - uint32_t colorOrIndex, SkCodec::ZeroInitialized zeroInit, SkSampler* sampler) { |
| + uint64_t colorOrIndex, SkCodec::ZeroInitialized zeroInit, SkSampler* sampler) { |
| if (sampler) { |
| sampler->fill(info, dst, rowBytes, colorOrIndex, zeroInit); |
| } else { |
| @@ -366,7 +383,7 @@ void SkCodec::fillIncompleteImage(const SkImageInfo& info, void* dst, size_t row |
| ZeroInitialized zeroInit, int linesRequested, int linesDecoded) { |
| void* fillDst; |
| - const uint32_t fillValue = this->getFillValue(info.colorType()); |
| + const uint64_t fillValue = this->getFillValue(info); |
| const int linesRemaining = linesRequested - linesDecoded; |
| SkSampler* sampler = this->getSampler(false); |