Lines Matching refs:fn
98 // A generic driver that maps fn over a src array into a dst array.
99 // fn should take an Sk4px (4 src pixels) and return an Sk4px (4 dst pixels).
100 template <typename Fn>
101 static void MapSrc(int n, SkPMColor* dst, const SkPMColor* src, const Fn& fn) {
104 // This looks a bit odd, but it helps loop-invariant hoisting across different calls to fn.
108 Sk4px dst0 = fn(Load4(src+0)),
109 dst4 = fn(Load4(src+4));
117 fn(Load4(src)).store4(dst);
121 fn(Load2(src)).store2(dst);
125 fn(Load1(src)).store1(dst);
131 // As above, but with dst4' = fn(dst4, src4).
132 template <typename Fn>
133 static void MapDstSrc(int n, SkPMColor* dst, const SkPMColor* src, const Fn& fn) {
138 Sk4px dst0 = fn(Load4(dst+0), Load4(src+0)),
139 dst4 = fn(Load4(dst+4), Load4(src+4));
147 fn(Load4(dst), Load4(src)).store4(dst);
151 fn(Load2(dst), Load2(src)).store2(dst);
155 fn(Load1(dst), Load1(src)).store1(dst);
161 // As above, but with dst4' = fn(dst4, alpha4).
162 template <typename Fn>
163 static void MapDstAlpha(int n, SkPMColor* dst, const SkAlpha* a, const Fn& fn) {
168 Sk4px dst0 = fn(Load4(dst+0), Load4Alphas(a+0)),
169 dst4 = fn(Load4(dst+4), Load4Alphas(a+4));
177 fn(Load4(dst), Load4Alphas(a)).store4(dst);
181 fn(Load2(dst), Load2Alphas(a)).store2(dst);
185 fn(Load1(dst), DupAlpha(*a)).store1(dst);
191 // As above, but with dst4' = fn(dst4, src4, alpha4).
192 template <typename Fn>
194 const Fn& fn) {
200 Sk4px dst0 = fn(Load4(dst+0), Load4(src+0), Load4Alphas(a+0)),
201 dst4 = fn(Load4(dst+4), Load4(src+4), Load4Alphas(a+4));
209 fn(Load4(dst), Load4(src), Load4Alphas(a)).store4(dst);
213 fn(Load2(dst), Load2(src), Load2Alphas(a)).store2(dst);
217 fn(Load1(dst), Load1(src), DupAlpha(*a)).store1(dst);