diff options
author | Leon Scroggins III <scroggo@google.com> | 2017-06-05 15:53:38 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-06-05 20:14:57 +0000 |
commit | c6e6a5f45e54006e861275a6d5c165830f403dcd (patch) | |
tree | 3d4bc3a0c43d6c2986728a3dffdec43e8547f43f /src/codec/SkCodecPriv.h | |
parent | 348060fa820e1ee7a4fd246afe517a80a9ef311d (diff) |
Simplify SkCodecs' call to SkColorSpaceXform::apply
Most SkCodec subclasses did the following to apply their
SkColorSpaceXform:
dstFormat = select_xform_format(dstInfo.colorType());
srcFormat = select_xform_format(<something that doesn't change>);
xformAlphaType = select_xform_alpha(dstInfo.alphaType(),
this->getInfo().alphaType());
this->colorXform()->apply(dstFormat, dst, srcFormat, src, width,
xformAlphaType);
Consolidate the computation of these parameters into SkCodec and add a
new method to SkCodec that calls apply() with those parameters.
Add a SkColorSpaceXform::ColorFormat to SkCodec. This allows the new
method SkCodec::applyColorXform to supply the ColorFormat.
TBR=reed@google.com
(No change to public API.)
Change-Id: I8ea7ba4c0024be827a9f9359796c778744330f6e
Reviewed-on: https://skia-review.googlesource.com/18523
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'src/codec/SkCodecPriv.h')
-rw-r--r-- | src/codec/SkCodecPriv.h | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/src/codec/SkCodecPriv.h b/src/codec/SkCodecPriv.h index 5c8dc8747a..b69e48808e 100644 --- a/src/codec/SkCodecPriv.h +++ b/src/codec/SkCodecPriv.h @@ -323,11 +323,6 @@ static inline SkAlphaType select_xform_alpha(SkAlphaType dstAlphaType, SkAlphaTy return (kOpaque_SkAlphaType == srcAlphaType) ? kOpaque_SkAlphaType : dstAlphaType; } -static inline bool apply_xform_on_decode(SkColorType dstColorType, SkEncodedInfo::Color srcColor) { - // We will apply the color xform when reading the color table unless F16 is requested. - return SkEncodedInfo::kPalette_Color != srcColor || kRGBA_F16_SkColorType == dstColorType; -} - /* * Alpha Type Conversions * - kOpaque to kOpaque, kUnpremul, kPremul is valid @@ -365,23 +360,4 @@ static inline bool conversion_possible(const SkImageInfo& dst, const SkImageInfo } } -static inline SkColorSpaceXform::ColorFormat select_xform_format_ct(SkColorType colorType) { - switch (colorType) { - case kRGBA_8888_SkColorType: - return SkColorSpaceXform::kRGBA_8888_ColorFormat; - case kBGRA_8888_SkColorType: - return SkColorSpaceXform::kBGRA_8888_ColorFormat; - case kRGB_565_SkColorType: - case kIndex_8_SkColorType: -#ifdef SK_PMCOLOR_IS_RGBA - return SkColorSpaceXform::kRGBA_8888_ColorFormat; -#else - return SkColorSpaceXform::kBGRA_8888_ColorFormat; -#endif - default: - SkASSERT(false); - return SkColorSpaceXform::kRGBA_8888_ColorFormat; - } -} - #endif // SkCodecPriv_DEFINED |