framebuffer: implement alphablending for non-accelerated devices

This commit is contained in:
Stefan Seyfried
2012-11-24 11:46:33 +01:00
committed by Michael Liebmann
parent a5412a0202
commit 820426eaaa

View File

@@ -1808,8 +1808,17 @@ void CFrameBuffer::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32
d2 = (fb_pixel_t *) d; d2 = (fb_pixel_t *) d;
for (int count2 = 0; count2 < xc; count2++ ) { for (int count2 = 0; count2 < xc; count2++ ) {
fb_pixel_t pix = *(pixpos + xp); fb_pixel_t pix = *(pixpos + xp);
if (!transp || (pix != 0)) { if (!transp || (pix & 0xff000000) == 0xff000000)
*d2 = pix; *d2 = pix;
else {
uint8_t *in = (uint8_t *)(pixpos + xp);
uint8_t *out = (uint8_t *)d2;
int a = in[3]; /* TODO: big/little endian */
*out = (*out + ((*in - *out) * a) / 256);
in++; out++;
*out = (*out + ((*in - *out) * a) / 256);
in++; out++;
*out = (*out + ((*in - *out) * a) / 256);
} }
d2++; d2++;
pixpos++; pixpos++;