Lines Matching refs:fn
106 // A generic driver that maps fn over a src array into a dst array.
107 // fn should take an Sk4px (4 src pixels) and return an Sk4px (4 dst pixels).
108 template <typename Fn>
109 static void MapSrc(int n, SkPMColor* dst, const SkPMColor* src, const Fn& fn) {
112 // This looks a bit odd, but it helps loop-invariant hoisting across different calls to fn.
116 Sk4px dst0 = fn(Load4(src+0)),
117 dst4 = fn(Load4(src+4));
125 fn(Load4(src)).store4(dst);
129 fn(Load2(src)).store2(dst);
133 fn(Load1(src)).store1(dst);
139 // As above, but with dst4' = fn(dst4, src4).
140 template <typename Fn>
141 static void MapDstSrc(int n, SkPMColor* dst, const SkPMColor* src, const Fn& fn) {
146 Sk4px dst0 = fn(Load4(dst+0), Load4(src+0)),
147 dst4 = fn(Load4(dst+4), Load4(src+4));
155 fn(Load4(dst), Load4(src)).store4(dst);
159 fn(Load2(dst), Load2(src)).store2(dst);
163 fn(Load1(dst), Load1(src)).store1(dst);
169 // As above, but with dst4' = fn(dst4, alpha4).
170 template <typename Fn>
171 static void MapDstAlpha(int n, SkPMColor* dst, const SkAlpha* a, const Fn& fn) {
176 Sk4px dst0 = fn(Load4(dst+0), Load4Alphas(a+0)),
177 dst4 = fn(Load4(dst+4), Load4Alphas(a+4));
185 fn(Load4(dst), Load4Alphas(a)).store4(dst);
189 fn(Load2(dst), Load2Alphas(a)).store2(dst);
193 fn(Load1(dst), Sk16b(*a)).store1(dst);
199 // As above, but with dst4' = fn(dst4, src4, alpha4).
200 template <typename Fn>
202 const Fn& fn) {
208 Sk4px dst0 = fn(Load4(dst+0), Load4(src+0), Load4Alphas(a+0)),
209 dst4 = fn(Load4(dst+4), Load4(src+4), Load4Alphas(a+4));
217 fn(Load4(dst), Load4(src), Load4Alphas(a)).store4(dst);
221 fn(Load2(dst), Load2(src), Load2Alphas(a)).store2(dst);
225 fn(Load1(dst), Load1(src), Sk16b(*a)).store1(dst);