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

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: Remove code to fix transparent decodes 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
Index: src/codec/SkCodec_libpng.cpp
diff --git a/src/codec/SkCodec_libpng.cpp b/src/codec/SkCodec_libpng.cpp
index 9f9c110cc68bcc06ed9d38c7c272cdecea42341a..e961f6b4dbdc77cf43bf3e6ac57efb2aca83a1d9 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:

Powered by Google App Engine
This is Rietveld 408576698