diff options
author | Leon Scroggins <scroggo@google.com> | 2017-07-10 19:51:46 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-10 19:51:59 +0000 |
commit | 8321f7585b6aded0c35e50e9af8709b25fdce3f6 (patch) | |
tree | 9a9e3a1843c8864a9e847d0c7b59b987946f6b24 /src/codec/SkCodecPriv.h | |
parent | a48ae6ec2feb32e3d781ad43353209a90059a01d (diff) |
Revert "Remove support for decoding to kIndex_8"
This reverts commit 742a3e298fda669006147e4a305bab8452369b1f.
Reason for revert: Breaking Android roll:
frameworks/base/core/jni/android/graphics/BitmapFactory.cpp:453:18: error: no member named 'fColorPtr' in 'SkAndroidCodec::AndroidOptions'
codecOptions.fColorPtr = colorPtr;
~~~~~~~~~~~~ ^
frameworks/base/core/jni/android/graphics/BitmapFactory.cpp:454:18: error: no member named 'fColorCount' in 'SkAndroidCodec::AndroidOptions'
codecOptions.fColorCount = colorCount;
~~~~~~~~~~~~ ^
Original change's description:
> Remove support for decoding to kIndex_8
>
> Fix up callsites, and remove tests that no longer make sense.
>
> Bug: skia:6828
> Change-Id: I2548c4b7528b7b1be7412563156f27b52c9d4295
> Reviewed-on: https://skia-review.googlesource.com/21664
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Commit-Queue: Leon Scroggins <scroggo@google.com>
TBR=djsollen@google.com,scroggo@google.com
Change-Id: I1bc669441f250690884e75a9a61427fdf75c6907
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:6828
Reviewed-on: https://skia-review.googlesource.com/22120
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'src/codec/SkCodecPriv.h')
-rw-r--r-- | src/codec/SkCodecPriv.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/codec/SkCodecPriv.h b/src/codec/SkCodecPriv.h index cb7cd94979..b69e48808e 100644 --- a/src/codec/SkCodecPriv.h +++ b/src/codec/SkCodecPriv.h @@ -128,6 +128,8 @@ static inline uint64_t get_color_table_fill_value(SkColorType dstColorType, SkAl return colorPtr[fillIndex]; case kRGB_565_SkColorType: return SkPixel32ToPixel16(colorPtr[fillIndex]); + case kIndex_8_SkColorType: + return fillIndex; case kRGBA_F16_SkColorType: { SkASSERT(colorXform); uint64_t dstColor; @@ -146,6 +148,20 @@ static inline uint64_t get_color_table_fill_value(SkColorType dstColorType, SkAl } /* + * + * Copy the codec color table back to the client when kIndex8 color type is requested + */ +static inline void copy_color_table(const SkImageInfo& dstInfo, SkColorTable* colorTable, + SkPMColor* inputColorPtr, int* inputColorCount) { + if (kIndex_8_SkColorType == dstInfo.colorType()) { + SkASSERT(nullptr != inputColorPtr); + SkASSERT(nullptr != inputColorCount); + SkASSERT(nullptr != colorTable); + memcpy(inputColorPtr, colorTable->readColors(), *inputColorCount * sizeof(SkPMColor)); + } +} + +/* * Compute row bytes for an image using pixels per byte */ static inline size_t compute_row_bytes_ppb(int width, uint32_t pixelsPerByte) { @@ -315,6 +331,7 @@ static inline SkAlphaType select_xform_alpha(SkAlphaType dstAlphaType, SkAlphaTy * 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 if kOpaque and color correction is not required * - Support k565 if it matches the src, kOpaque, and color correction is not required */ @@ -331,6 +348,8 @@ static inline bool conversion_possible(const SkImageInfo& dst, const SkImageInfo 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: return kOpaque_SkAlphaType == src.alphaType(); case kGray_8_SkColorType: |