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

Unified Diff: src/codec/SkCodecPriv.h

Issue 2328663002: Revert of Checking for valid colorType, alphaType, colorSpace in SkCodec (Closed)
Patch Set: Created 4 years, 3 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/SkBmpStandardCodec.cpp ('k') | src/codec/SkGifCodec.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkCodecPriv.h
diff --git a/src/codec/SkCodecPriv.h b/src/codec/SkCodecPriv.h
index 4285786304b3fa8fcefe6e9808e3b3d5a0c94455..9a8a43e8352a7d9a783ba9a6a343bf278266eb8a 100644
--- a/src/codec/SkCodecPriv.h
+++ b/src/codec/SkCodecPriv.h
@@ -107,18 +107,14 @@
}
/*
- * Original version of conversion_possible that does not account for color spaces.
- * Used by codecs that have not been updated to support color spaces.
- *
* Most of our codecs support the same conversions:
* - opaque to any alpha type
* - 565 only if opaque
* - premul to unpremul and vice versa
- * - always support RGBA, BGRA
+ * - always support N32
* - otherwise match the src color type
*/
-static inline bool conversion_possible_ignore_color_space(const SkImageInfo& dst,
- const SkImageInfo& src) {
+static inline bool conversion_possible(const SkImageInfo& dst, const SkImageInfo& src) {
// Ensure the alpha type is valid
if (!valid_alpha(dst.alphaType(), src.alphaType())) {
return false;
@@ -339,38 +335,4 @@
return (kOpaque_SkAlphaType == srcAlphaType) ? kOpaque_SkAlphaType : dstAlphaType;
}
-/*
- * Alpha Type Conversions
- * - kOpaque to kOpaque, kUnpremul, kPremul is valid
- * - kUnpremul to kUnpremul, kPremul is valid
- *
- * Color Type Conversions
- * - Always support kRGBA_8888, kBGRA_8888
- * - Support kRGBA_F16 when there is a linear dst color space
- * - Support kIndex8 if it matches the src
- * - Support k565, kGray8 if kOpaque and color correction is not required
- */
-static inline bool conversion_possible(const SkImageInfo& dst, const SkImageInfo& src) {
- // Ensure the alpha type is valid.
- if (!valid_alpha(dst.alphaType(), src.alphaType())) {
- return false;
- }
-
- // Check for supported color types.
- switch (dst.colorType()) {
- case kRGBA_8888_SkColorType:
- case kBGRA_8888_SkColorType:
- return true;
- case kRGBA_F16_SkColorType:
- return dst.colorSpace() && dst.colorSpace()->gammaIsLinear();
- case kIndex_8_SkColorType:
- return kIndex_8_SkColorType == src.colorType();
- case kRGB_565_SkColorType:
- case kGray_8_SkColorType:
- return kOpaque_SkAlphaType == src.alphaType() && !needs_color_xform(dst, src);
- default:
- return false;
- }
-}
-
#endif // SkCodecPriv_DEFINED
« no previous file with comments | « src/codec/SkBmpStandardCodec.cpp ('k') | src/codec/SkGifCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698