aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkBmpMaskCodec.cpp
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-02-12 13:07:15 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-12 13:07:15 -0800
commitc7578b6cdd03b61f076ffc7956efd952d6c301c0 (patch)
tree8a3618f653636727d677e2057d1c7d93567a27b7 /src/codec/SkBmpMaskCodec.cpp
parentdae774eff41b36ae6511450d458060dd3d031689 (diff)
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 Review URL: https://codereview.chromium.org/1695473002
Diffstat (limited to 'src/codec/SkBmpMaskCodec.cpp')
-rw-r--r--src/codec/SkBmpMaskCodec.cpp21
1 files changed, 4 insertions, 17 deletions
diff --git a/src/codec/SkBmpMaskCodec.cpp b/src/codec/SkBmpMaskCodec.cpp
index b603de9a03..21d231b15f 100644
--- a/src/codec/SkBmpMaskCodec.cpp
+++ b/src/codec/SkBmpMaskCodec.cpp
@@ -57,25 +57,12 @@ SkCodec::Result SkBmpMaskCodec::onGetPixels(const SkImageInfo& dstInfo,
return kSuccess;
}
-bool SkBmpMaskCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& options) {
- // Create the swizzler
- fMaskSwizzler.reset(SkMaskSwizzler::CreateMaskSwizzler(dstInfo, this->getInfo(), fMasks,
- this->bitsPerPixel(), options));
-
- 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;
- }
+ // Initialize the mask swizzler
+ fMaskSwizzler.reset(SkMaskSwizzler::CreateMaskSwizzler(dstInfo, this->getInfo(), fMasks,
+ this->bitsPerPixel(), options));
+ SkASSERT(fMaskSwizzler);
return SkCodec::kSuccess;
}