diff options
author | 2016-02-12 15:00:10 -0800 | |
---|---|---|
committer | 2016-02-12 15:00:10 -0800 | |
commit | deabdb5b9712de9e3c6bbb9aa68ec2f20df80a8e (patch) | |
tree | df8951bf09f0dc3b1926d082340f65c3e756100a /src/codec/SkBmpMaskCodec.cpp | |
parent | 3478f753ffc28a6f0f0877cc06be7373f960c527 (diff) |
Revert of Fix colorType/alphaType checks in SkCodec (patchset #5 id:80001 of https://codereview.chromium.org/1695473002/ )
Reason for revert:
Really bad images in Gold.
Original issue's description:
> Fix colorType/alphaType checks in SkCodec
>
> Make getPixels() and startScanlineDecode() behave
> consistently.
>
> Require that kGray8 decodes are opaque.
>
> Assert that creating the swizzler succeeds.
>
> BUG=skia:4203
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1695473002
>
> Committed: https://skia.googlesource.com/skia/+/c7578b6cdd03b61f076ffc7956efd952d6c301c0
TBR=scroggo@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:4203
Review URL: https://codereview.chromium.org/1694023002
Diffstat (limited to 'src/codec/SkBmpMaskCodec.cpp')
-rw-r--r-- | src/codec/SkBmpMaskCodec.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/codec/SkBmpMaskCodec.cpp b/src/codec/SkBmpMaskCodec.cpp index 21d231b15f..b603de9a03 100644 --- a/src/codec/SkBmpMaskCodec.cpp +++ b/src/codec/SkBmpMaskCodec.cpp @@ -57,12 +57,25 @@ SkCodec::Result SkBmpMaskCodec::onGetPixels(const SkImageInfo& dstInfo, return kSuccess; } -SkCodec::Result SkBmpMaskCodec::prepareToDecode(const SkImageInfo& dstInfo, - const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputColorCount) { - // Initialize the mask swizzler +bool SkBmpMaskCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& options) { + // Create the swizzler fMaskSwizzler.reset(SkMaskSwizzler::CreateMaskSwizzler(dstInfo, this->getInfo(), fMasks, this->bitsPerPixel(), options)); - SkASSERT(fMaskSwizzler); + + if (nullptr == fMaskSwizzler.get()) { + return false; + } + + return true; +} + +SkCodec::Result SkBmpMaskCodec::prepareToDecode(const SkImageInfo& dstInfo, + const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputColorCount) { + // Initialize a the mask swizzler + if (!this->initializeSwizzler(dstInfo, options)) { + SkCodecPrintf("Error: cannot initialize swizzler.\n"); + return SkCodec::kInvalidConversion; + } return SkCodec::kSuccess; } |