aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkCodecPriv.h
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-09-16 09:51:12 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-16 09:51:12 -0700
commit43d6651111374b5d1e4ddd9030dcf079b448ec47 (patch)
treecd015928e14895e720154f156aab1e14d3536787 /src/codec/SkCodecPriv.h
parenta8370b2c56e42b9e29b4cfbda95d14fdfba7f15e (diff)
Support Float32 output from SkColorSpaceXform
* Adds Float32 support to SkColorSpaceXform * Changes API to allows clients to ask for F32, updates clients to new API * Adds Sk4f_load4 and Sk4f_store4 to SkNx * Make use of new xform in SkGr.cpp BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2339233003 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Review-Url: https://codereview.chromium.org/2339233003
Diffstat (limited to 'src/codec/SkCodecPriv.h')
-rw-r--r--src/codec/SkCodecPriv.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/codec/SkCodecPriv.h b/src/codec/SkCodecPriv.h
index 8876b72aa7..830f153cba 100644
--- a/src/codec/SkCodecPriv.h
+++ b/src/codec/SkCodecPriv.h
@@ -144,6 +144,20 @@ static inline const SkPMColor* get_color_ptr(SkColorTable* colorTable) {
return nullptr != colorTable ? colorTable->readColors() : nullptr;
}
+static inline SkColorSpaceXform::ColorFormat select_xform_format(SkColorType colorType) {
+ switch (colorType) {
+ case kRGBA_8888_SkColorType:
+ return SkColorSpaceXform::kRGBA_8888_ColorFormat;
+ case kBGRA_8888_SkColorType:
+ return SkColorSpaceXform::kBGRA_8888_ColorFormat;
+ case kRGBA_F16_SkColorType:
+ return SkColorSpaceXform::kRGBA_F16_ColorFormat;
+ default:
+ SkASSERT(false);
+ return SkColorSpaceXform::kRGBA_8888_ColorFormat;
+ }
+}
+
/*
* Given that the encoded image uses a color table, return the fill value
*/
@@ -162,7 +176,7 @@ static inline uint64_t get_color_table_fill_value(SkColorType colorType, SkAlpha
SkASSERT(colorXform);
uint64_t dstColor;
uint32_t srcColor = colorPtr[fillIndex];
- colorXform->apply(&dstColor, &srcColor, 1, colorType, alphaType);
+ colorXform->apply(&dstColor, &srcColor, 1, select_xform_format(colorType), alphaType);
return dstColor;
}
default:
@@ -343,7 +357,7 @@ static inline bool needs_color_xform(const SkImageInfo& dstInfo, const SkImageIn
return !isLegacy && (needsPremul || isF16 || srcDstNotEqual);
}
-static inline SkAlphaType select_alpha_xform(SkAlphaType dstAlphaType, SkAlphaType srcAlphaType) {
+static inline SkAlphaType select_xform_alpha(SkAlphaType dstAlphaType, SkAlphaType srcAlphaType) {
return (kOpaque_SkAlphaType == srcAlphaType) ? kOpaque_SkAlphaType : dstAlphaType;
}