79 {
82 const float src = (
float)srcI / 255.0f;
83 const float linSrc = srcConvert.
toLuma(srcGamma,
src);
84
85
86
87
88 const float dst = 1.0f -
src;
89 const float linDst = dstConvert.
toLuma(dstGamma,
dst);
90
91
92 const float adjustedContrast = contrast * linDst;
93
94
95
96 if (fabs(
src -
dst) < (1.0f / 256.0f)) {
97 float ii = 0.0f;
98 for (
int i = 0;
i < 256; ++
i, ii += 1.0f) {
99 float rawSrca = ii / 255.0f;
102 }
103 } else {
104
105 float ii = 0.0f;
106 for (
int i = 0;
i < 256; ++
i, ii += 1.0f) {
107
108
109
110
111 float rawSrca = ii / 255.0f;
114 float dsta = 1.0f - srca;
115
116
117 float linOut = (linSrc * srca + dsta * linDst);
120
121
124
126 }
127 }
128}
#define sk_float_round2int(x)
static float apply_contrast(float srca, float contrast)
constexpr uint8_t SkToU8(S x)
virtual SkScalar fromLuma(SkScalar gamma, SkScalar luma) const =0
virtual SkScalar toLuma(SkScalar gamma, SkScalar luminance) const =0