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

Unified Diff: src/codec/SkCodecPriv.h

Issue 1641273003: Support decoding opaque to *premul (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Test opaque to premul in dm Created 4 years, 11 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/SkCodecPriv.h
diff --git a/src/codec/SkCodecPriv.h b/src/codec/SkCodecPriv.h
index 27e2a63722d8ff095911846ece0d45d46cc7479f..4ae049744c3017b4a1a87da9800845c2404df04c 100644
--- a/src/codec/SkCodecPriv.h
+++ b/src/codec/SkCodecPriv.h
@@ -75,11 +75,14 @@ inline bool is_coord_necessary(int srcCoord, int sampleFactor, int scaledDim) {
}
inline bool valid_alpha(SkAlphaType dstAlpha, SkAlphaType srcAlpha) {
- // Check for supported alpha types
+ if (kUnknown_SkAlphaType == dstAlpha) {
+ return false;
+ }
+
if (srcAlpha != dstAlpha) {
if (kOpaque_SkAlphaType == srcAlpha) {
- // If the source is opaque, we must decode to opaque
- return false;
+ // If the source is opaque, we can support any.
+ return true;
}
// The source is not opaque
@@ -99,7 +102,8 @@ inline bool valid_alpha(SkAlphaType dstAlpha, SkAlphaType srcAlpha) {
/*
* Most of our codecs support the same conversions:
* - profileType must be the same
- * - opaque only to opaque (and 565 only if opaque)
+ * - opaque to any alpha type
+ * - 565 only if opaque
* - premul to unpremul and vice versa
* - always support N32
* - otherwise match the src color type
« dm/DM.cpp ('K') | « src/codec/SkCodec.cpp ('k') | src/codec/SkGifCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698