diff options
author | msarett <msarett@google.com> | 2016-02-12 13:07:15 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-12 13:07:15 -0800 |
commit | c7578b6cdd03b61f076ffc7956efd952d6c301c0 (patch) | |
tree | 8a3618f653636727d677e2057d1c7d93567a27b7 /src/codec/SkCodecPriv.h | |
parent | dae774eff41b36ae6511450d458060dd3d031689 (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/SkCodecPriv.h')
-rw-r--r-- | src/codec/SkCodecPriv.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/codec/SkCodecPriv.h b/src/codec/SkCodecPriv.h index 235c4e24af..5d66118943 100644 --- a/src/codec/SkCodecPriv.h +++ b/src/codec/SkCodecPriv.h @@ -136,7 +136,12 @@ inline bool conversion_possible(const SkImageInfo& dst, const SkImageInfo& src) case kN32_SkColorType: return true; case kRGB_565_SkColorType: - return src.alphaType() == kOpaque_SkAlphaType; + return kOpaque_SkAlphaType == dst.alphaType(); + case kGray_8_SkColorType: + if (kOpaque_SkAlphaType != dst.alphaType()) { + return false; + } + // Fall through default: return dst.colorType() == src.colorType(); } |