Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: src/codec/SkCodec_libpng.cpp

Issue 1258863008: Split SkBmpCodec into three separate classes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codec/SkCodecPriv.h ('k') | src/codec/SkMaskSwizzler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:
« no previous file with comments | « src/codec/SkCodecPriv.h ('k') | src/codec/SkMaskSwizzler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698