Lines Matching refs:Sk4f
17 static Sk4f scale_by_coverage(const Sk4f& x4, uint8_t coverage) {
18 return x4 * Sk4f(coverage * (1/255.0f));
21 static Sk4f lerp(const Sk4f& src, const Sk4f& dst, uint8_t srcCoverage) {
22 return dst + (src - dst) * Sk4f(srcCoverage * (1/255.0f));
25 template <DstType D> Sk4f load_dst(SkPMColor dstC) {
29 static Sk4f srgb_4b_to_linear_unit(SkPMColor dstC) {
33 template <DstType D> uint32_t store_dst(const Sk4f& x4) {
37 static Sk4f linear_unit_to_srgb_255f(const Sk4f& l4) {
38 return linear_to_srgb(l4) * Sk4f(255) + Sk4f(0.5f);
49 Sk4f d4 = load_dst<D>(dst[i]);
51 Sk4f r4 = Sk4f::Load(proc(*src, d).fVec);
57 Sk4f r4 = Sk4f::Load(proc(*src, d).fVec);
69 Sk4f d4 = load_dst<D>(dst[i]);
71 Sk4f r4 = Sk4f::Load(proc(src[i], d).fVec);
77 Sk4f r4 = Sk4f::Load(proc(src[i], d).fVec);
116 Sk4f d = Sk4f_fromS32(dst[i]) * Sk4f((255 - aa[i]) * (1/255.0f));
144 Sk4f r4 = Sk4f::Load(src[i].fVec); // src always overrides dst
146 Sk4f d4 = load_dst<D>(dst[i]);
153 static Sk4f lerp(const Sk4f& src, const Sk4f& dst, const Sk4f& src_scale) {
159 const Sk4f s4 = Sk4f::Load(src->fVec);
164 const Sk4f& s4_255 = s4 * Sk4f(255);
166 Sk4f aa4 = SkNx_cast<float>(Sk4b::Load(aa)) * Sk4f(1/255.f);
167 Sk4f r0 = lerp(s4_255, to_4f(dst[0]), Sk4f(aa4[0])) + Sk4f(0.5f);
168 Sk4f r1 = lerp(s4_255, to_4f(dst[1]), Sk4f(aa4[1])) + Sk4f(0.5f);
169 Sk4f r2 = lerp(s4_255, to_4f(dst[2]), Sk4f(aa4[2])) + Sk4f(0.5f);
170 Sk4f r3 = lerp(s4_255, to_4f(dst[3]), Sk4f(aa4[3])) + Sk4f(0.5f);
179 Sk4f aa4 = SkNx_cast<float>(Sk4b::Load(aa)) * Sk4f(1/255.0f);
185 Sk4f r0 = lerp(s4, load_dst<D>(dst[0]), Sk4f(aa4[0]));
186 Sk4f r1 = lerp(s4, load_dst<D>(dst[1]), Sk4f(aa4[1]));
187 Sk4f r2 = lerp(s4, load_dst<D>(dst[2]), Sk4f(aa4[2]));
188 Sk4f r3 = lerp(s4, load_dst<D>(dst[3]), Sk4f(aa4[3]));
202 Sk4f d4 = load_dst<D>(dst[i]);
235 Sk4f s4 = Sk4f::Load(src[i].fVec);
236 Sk4f d4 = load_dst<D>(dst[i]);
240 Sk4f r4 = s4 + d4 * Sk4f(1 - get_alpha(s4));
245 Sk4f s4 = Sk4f::Load(src[i].fVec);
246 Sk4f d4 = load_dst<D>(dst[i]);
247 Sk4f r4 = s4 + d4 * Sk4f(1 - get_alpha(s4));
255 const Sk4f s4 = Sk4f::Load(src->fVec);
256 const Sk4f dst_scale = Sk4f(1 - get_alpha(s4));
264 Sk4f d4 = Sk4f_fromL32(dst[i]);
265 Sk4f r4;
267 Sk4f s4_aa = scale_by_coverage(s4, a);
268 r4 = s4_aa + d4 * Sk4f(1 - get_alpha(s4_aa));
275 const Sk4f s4_255 = s4 * Sk4f(255) + Sk4f(0.5f); // +0.5 to pre-bias for rounding
277 Sk4f d0 = to_4f(dst[0]);
278 Sk4f d1 = to_4f(dst[1]);
279 Sk4f d2 = to_4f(dst[2]);
280 Sk4f d3 = to_4f(dst[3]);
290 Sk4f d4 = to_4f(dst[i]);
298 Sk4f s4 = Sk4f::Load(src->fVec);
299 Sk4f dst_scale = Sk4f(1 - get_alpha(s4));
307 Sk4f d4 = srgb_4b_to_linear_unit(dst[i]);
308 Sk4f r4;
310 const Sk4f s4_aa = scale_by_coverage(s4, a);
311 r4 = s4_aa + d4 * Sk4f(1 - get_alpha(s4_aa));
319 Sk4f d0 = srgb_4b_to_linear_unit(dst[0]);
320 Sk4f d1 = srgb_4b_to_linear_unit(dst[1]);
321 Sk4f d2 = srgb_4b_to_linear_unit(dst[2]);
322 Sk4f d3 = srgb_4b_to_linear_unit(dst[3]);
332 Sk4f d4 = srgb_4b_to_linear_unit(dst[i]);
378 static Sk4f lcd16_to_unit_4f(uint16_t rgb) {
384 return SkNx_cast<float>(rgbi) * Sk4f(1.0f/31, 1.0f/63, 1.0f/31, 0);
389 const Sk4f s4 = Sk4f::Load(src->fVec);
393 const Sk4f s4bias = s4 * Sk4f(255);
399 Sk4f d4bias = to_4f(dst[i]);
408 Sk4f d4 = load_dst<D>(dst[i]);
421 Sk4f s4 = Sk4f::Load(src[i].fVec);
422 Sk4f d4 = load_dst<D>(dst[i]);
429 const Sk4f s4 = Sk4f::Load(src->fVec);
430 Sk4f dst_scale = Sk4f(1 - get_alpha(s4));
437 Sk4f d4 = load_dst<D>(dst[i]);
438 Sk4f r4 = s4 + d4 * dst_scale;
451 Sk4f s4 = Sk4f::Load(src[i].fVec);
452 Sk4f dst_scale = Sk4f(1 - get_alpha(s4));
453 Sk4f d4 = load_dst<D>(dst[i]);
454 Sk4f r4 = s4 + d4 * dst_scale;