| Index: src/codec/SkCodecPriv.h
|
| diff --git a/src/codec/SkCodecPriv.h b/src/codec/SkCodecPriv.h
|
| index 2596787b9b7aadcf44819e23849467b137c48cc7..10719c96fc1f68ae7a06cb638a7f20016ad4f925 100644
|
| --- a/src/codec/SkCodecPriv.h
|
| +++ b/src/codec/SkCodecPriv.h
|
| @@ -33,19 +33,22 @@
|
| static inline bool valid_alpha(SkAlphaType dstAlpha, SkAlphaType srcAlpha) {
|
| // Check for supported alpha types
|
| if (srcAlpha != dstAlpha) {
|
| - if (kOpaque_SkAlphaType == srcAlpha) {
|
| - // If the source is opaque, we must decode to opaque
|
| + if (kOpaque_SkAlphaType == dstAlpha) {
|
| return false;
|
| }
|
|
|
| - // The source is not opaque
|
| switch (dstAlpha) {
|
| + case kOpaque_SkAlphaType:
|
| + // If the source is not opaque, we cannot decode to opaque
|
| + return false;
|
| case kPremul_SkAlphaType:
|
| case kUnpremul_SkAlphaType:
|
| - // The source is not opaque, so either of these is okay
|
| + // Opaque can trivially be treated as both, so no conversion is
|
| + // actually necessary.
|
| + // Switching between premul and unpremul is supported.
|
| break;
|
| default:
|
| - // We cannot decode a non-opaque image to opaque (or unknown)
|
| + // We cannot decode a non-opaque image to opaque (or unknown
|
| return false;
|
| }
|
| }
|
|
|