diff options
author | msarett <msarett@google.com> | 2016-09-08 10:54:34 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-08 10:54:34 -0700 |
commit | 85c922acec37726ac64e9be9a79de697c677f35d (patch) | |
tree | ce407f846cdad8e4cf71c6d0479a1588b45d5cf6 /src/codec/SkCodecPriv.h | |
parent | 7a9900d6d34e437bb24beb5524a1f6488ae138c9 (diff) |
Revert of Checking for valid colorType, alphaType, colorSpace in SkCodec (patchset #2 id:100001 of https://codereview.chromium.org/2319293003/ )
Reason for revert:
Broken perf bots
Original issue's description:
> Checking for valid colorType, alphaType, colorSpace in SkCodec
>
> * Refactor to share code between SkPngCodec and SkWebpCodec
> * Didn't end up sharing with SkJpegCodec but did refactor
> that code a bit
> * Disallow conversions to F16 with non-linear color spaces
> * Fail to decode if we fail to create a SkColorSpaceXform
> (should be an assert soon). We used to fallback on a
> legacy decode if we failed to create the transform.
> * A bunch of name changes
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2319293003
>
> Committed: https://skia.googlesource.com/skia/+/7a9900d6d34e437bb24beb5524a1f6488ae138c9
TBR=scroggo@google.com,brianosman@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review-Url: https://codereview.chromium.org/2328663002
Diffstat (limited to 'src/codec/SkCodecPriv.h')
-rw-r--r-- | src/codec/SkCodecPriv.h | 42 |
1 files changed, 2 insertions, 40 deletions
diff --git a/src/codec/SkCodecPriv.h b/src/codec/SkCodecPriv.h index 4285786304..9a8a43e835 100644 --- a/src/codec/SkCodecPriv.h +++ b/src/codec/SkCodecPriv.h @@ -107,18 +107,14 @@ static inline bool valid_alpha(SkAlphaType dstAlpha, SkAlphaType srcAlpha) { } /* - * 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 @@ static inline SkAlphaType select_alpha_xform(SkAlphaType dstAlphaType, SkAlphaTy 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 |