diff options
author | Mike Reed <reed@google.com> | 2017-07-12 22:10:29 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-13 10:44:42 +0000 |
commit | 580501382fb1418fff7acc63680f3a9a6bf3938c (patch) | |
tree | 16a93a72852e282b1f520dcc947985e2190a45bf /src/images | |
parent | 4d41b8f2fdae21a6ed16fca6242d53e7c08349d0 (diff) |
Guard to remove kIndex_8_SkColorType
Bug: skia:6828
Change-Id: Ia942a36abb18213184f8d436555a658270d97d47
Reviewed-on: https://skia-review.googlesource.com/22721
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
Diffstat (limited to 'src/images')
-rw-r--r-- | src/images/SkJpegEncoder.cpp | 2 | ||||
-rw-r--r-- | src/images/SkPngEncoder.cpp | 9 | ||||
-rw-r--r-- | src/images/SkWebpEncoder.cpp | 4 |
3 files changed, 14 insertions, 1 deletions
diff --git a/src/images/SkJpegEncoder.cpp b/src/images/SkJpegEncoder.cpp index a0ee398615..ef78b214a3 100644 --- a/src/images/SkJpegEncoder.cpp +++ b/src/images/SkJpegEncoder.cpp @@ -113,6 +113,7 @@ bool SkJpegEncoderMgr::setParams(const SkImageInfo& srcInfo, const SkJpegEncoder jpegColorType = JCS_RGB; numComponents = 3; break; +#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE case kIndex_8_SkColorType: if (SkJpegEncoder::AlphaOption::kBlendOnBlack == options.fAlphaOption) { return false; @@ -122,6 +123,7 @@ bool SkJpegEncoderMgr::setParams(const SkImageInfo& srcInfo, const SkJpegEncoder jpegColorType = JCS_RGB; numComponents = 3; break; +#endif case kGray_8_SkColorType: SkASSERT(srcInfo.isOpaque()); jpegColorType = JCS_GRAYSCALE; diff --git a/src/images/SkPngEncoder.cpp b/src/images/SkPngEncoder.cpp index b0c2b23dfb..1e112690df 100644 --- a/src/images/SkPngEncoder.cpp +++ b/src/images/SkPngEncoder.cpp @@ -115,6 +115,7 @@ bool SkPngEncoderMgr::setHeader(const SkImageInfo& srcInfo, const SkPngEncoder:: pngColorType = srcInfo.isOpaque() ? PNG_COLOR_TYPE_RGB : PNG_COLOR_TYPE_RGB_ALPHA; fPngBytesPerPixel = 8; break; +#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE case kIndex_8_SkColorType: sigBit.red = 8; sigBit.green = 8; @@ -123,6 +124,7 @@ bool SkPngEncoderMgr::setHeader(const SkImageInfo& srcInfo, const SkPngEncoder:: pngColorType = PNG_COLOR_TYPE_PALETTE; fPngBytesPerPixel = 1; break; +#endif case kGray_8_SkColorType: sigBit.gray = 8; pngColorType = PNG_COLOR_TYPE_GRAY; @@ -250,7 +252,9 @@ static transform_scanline_proc choose_proc(const SkImageInfo& info, SkASSERT(false); return nullptr; } +#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE case kIndex_8_SkColorType: +#endif case kGray_8_SkColorType: return transform_scanline_memcpy; case kRGBA_F16_SkColorType: @@ -270,6 +274,7 @@ static transform_scanline_proc choose_proc(const SkImageInfo& info, } } +#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE /* * Pack palette[] with the corresponding colors, and if the image has alpha, also * pack trans[] and return the number of alphas[] entries written. If the image is @@ -331,6 +336,7 @@ static inline int pack_palette(SkColorTable* ctable, png_color* SK_RESTRICT pale return numWithAlpha; } +#endif bool SkPngEncoderMgr::setPalette(const SkImageInfo& srcInfo, SkColorTable* colorTable, SkTransferFunctionBehavior unpremulBehavior) { @@ -338,6 +344,7 @@ bool SkPngEncoderMgr::setPalette(const SkImageInfo& srcInfo, SkColorTable* color return false; } +#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE png_color paletteColors[256]; png_byte trans[256]; if (kIndex_8_SkColorType == srcInfo.colorType()) { @@ -351,7 +358,7 @@ bool SkPngEncoderMgr::setPalette(const SkImageInfo& srcInfo, SkColorTable* color png_set_tRNS(fPngPtr, fInfoPtr, trans, numTrans, nullptr); } } - +#endif return true; } diff --git a/src/images/SkWebpEncoder.cpp b/src/images/SkWebpEncoder.cpp index 296d4f4cf0..a5d0ffa838 100644 --- a/src/images/SkWebpEncoder.cpp +++ b/src/images/SkWebpEncoder.cpp @@ -86,6 +86,7 @@ static transform_scanline_proc choose_proc(const SkImageInfo& info, default: return nullptr; } +#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE case kIndex_8_SkColorType: switch (info.alphaType()) { case kOpaque_SkAlphaType: @@ -98,6 +99,7 @@ static transform_scanline_proc choose_proc(const SkImageInfo& info, default: return nullptr; } +#endif case kGray_8_SkColorType: return transform_scanline_gray; case kRGBA_F16_SkColorType: @@ -147,6 +149,7 @@ bool SkWebpEncoder::Encode(SkWStream* stream, const SkPixmap& pixmap, const Opti } const SkPMColor* colors = nullptr; +#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE SkPMColor storage[256]; if (kIndex_8_SkColorType == pixmap.colorType()) { if (!pixmap.ctable()) { @@ -162,6 +165,7 @@ bool SkWebpEncoder::Encode(SkWStream* stream, const SkPixmap& pixmap, const Opti colors = storage; } } +#endif WebPConfig webp_config; if (!WebPConfigPreset(&webp_config, WEBP_PRESET_DEFAULT, opts.fQuality)) { |