Index: src/codec/SkCodec_libpng.cpp |
diff --git a/src/codec/SkCodec_libpng.cpp b/src/codec/SkCodec_libpng.cpp |
index 7c6a74c13aab7d40d61e3717fa92b51960309024..f23990095ba40bba5a36f8c8b7dab1caf84353f6 100644 |
--- a/src/codec/SkCodec_libpng.cpp |
+++ b/src/codec/SkCodec_libpng.cpp |
@@ -397,24 +397,11 @@ static bool conversion_possible(const SkImageInfo& dst, const SkImageInfo& src) |
return false; |
} |
- // Check for supported alpha types |
- if (src.alphaType() != dst.alphaType()) { |
- if (kOpaque_SkAlphaType == src.alphaType()) { |
- // If the source is opaque, we must decode to opaque |
- return false; |
- } |
- |
- // The source is not opaque |
- switch (dst.alphaType()) { |
- case kPremul_SkAlphaType: |
- case kUnpremul_SkAlphaType: |
- // The source is not opaque, so either of these is okay |
- break; |
- default: |
- // We cannot decode a non-opaque image to opaque (or unknown) |
- return false; |
- } |
+ // Ensure the alpha type is valid |
+ if (!valid_alpha(dst.alphaType(), src.alphaType())) { |
+ return false; |
} |
+ |
// Check for supported color types |
switch (dst.colorType()) { |
case kN32_SkColorType: |