Esempio n. 1
0
void SkLerpXfermode::xfer32(SkPMColor dst[], const SkPMColor src[], int count,
                             const SkAlpha aa[]) const {
    const int scale = fScale256;

    if (aa) {
        for (int i = 0; i < count; ++i) {
            unsigned a = aa[i];
            if (a) {
                SkPMColor dstC = dst[i];
                SkPMColor resC = SkFastFourByteInterp256(src[i], dstC, scale);
                if (a < 255) {
                    resC = SkFastFourByteInterp256(resC, dstC, a + (a >> 7));
                }
                dst[i] = resC;
            }
        }
    } else {
void SkLumaMaskXfermode::xfer32(SkPMColor dst[], const SkPMColor src[],
                                int count, const SkAlpha aa[]) const {
    const SkPMColor* a = lumaOpA<SkPMColor>(fMode, src, dst);
    const SkPMColor* b = lumaOpB<SkPMColor>(fMode, src, dst);

    if (aa) {
        for (int i = 0; i < count; ++i) {
            unsigned cov = aa[i];
            if (cov) {
                unsigned resC = luma_proc(a[i], b[i]);
                if (cov < 255) {
                    resC = SkFastFourByteInterp256(resC, dst[i],
                                                   SkAlpha255To256(cov));
                }
                dst[i] = resC;
            }
        }
    } else {
        for (int i = 0; i < count; ++i) {
            dst[i] = luma_proc(a[i], b[i]);
        }
    }
}