42 if (luminance <= 0.04045f) {
43 return luminance / 12.92f;
52 if (luma <= 0.0031308f) {
66 return gSkSRGBColorSpaceLuminance;
68 return gSkLinearColorSpaceLuminance;
70 return gSkGammaColorSpaceLuminance;
75 return srca + ((1.0f - srca) * contrast * srca);
82 const float src = (
float)srcI / 255.0f;
83 const float linSrc = srcConvert.
toLuma(srcGamma,
src);
88 const float dst = 1.0f -
src;
89 const float linDst = dstConvert.
toLuma(dstGamma,
dst);
92 const float adjustedContrast = contrast * linDst;
96 if (fabs(
src -
dst) < (1.0f / 256.0f)) {
98 for (
int i = 0;
i < 256; ++
i, ii += 1.0f) {
99 float rawSrca = ii / 255.0f;
106 for (
int i = 0;
i < 256; ++
i, ii += 1.0f) {
111 float rawSrca = ii / 255.0f;
114 float dsta = 1.0f - srca;
117 float linOut = (linSrc * srca + dsta * linDst);
#define sk_float_round2int(x)
static float apply_contrast(float srca, float contrast)
void SkTMaskGamma_build_correcting_lut(uint8_t table[256], U8CPU srcI, SkScalar contrast, const SkColorSpaceLuminance &dstConvert, SkScalar dstGamma)
#define SkScalarInvert(x)
#define SkScalarPow(b, e)
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
constexpr uint8_t SkToU8(S x)
virtual SkScalar fromLuma(SkScalar gamma, SkScalar luma) const =0
virtual SkScalar toLuma(SkScalar gamma, SkScalar luminance) const =0
static const SkColorSpaceLuminance & Fetch(SkScalar gamma)