Hi there,
the default blit code for RGBA->RGBA blits leaves the destination alpha
channel untouched.
If one wants however to compose RGBA surfaces from other RGBA surfaces
by blitting, this is not necessarily a desired operation. What would
work in that case is, that the source alpha gets OR’ed into the
destination alpha. If one starts out with a black invisible image as
destination, the final, composed image turns out correctly.
This is a part of a working version of a the modified C-code blitter
that does this:
DUFFS_LOOP4( {
Uint32 pixel;
unsigned sR;
unsigned sG;
unsigned sB;
unsigned sA;
unsigned dR;
unsigned dG;
unsigned dB;
unsigned dA;
DISEMBLE_RGBA(src, srcbpp, srcfmt, pixel, sR, sG, sB,
sA);
DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB,
dA);
ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB);
dA |= sA;
ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
src += srcbpp;
dst += dstbpp;
}, width);
Could someone help in making modifications to a MMX blitter so it does
the above operation - a faster routine is important, since hardware
blitting on the video card can probably not do this and a software
blitter would be the default for this operation.
Cheers
Andreas