From 820426eaaa616e4ff8bcc3d3d07c96cff269bf55 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 24 Nov 2012 11:46:33 +0100 Subject: [PATCH] framebuffer: implement alphablending for non-accelerated devices --- src/driver/framebuffer.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/driver/framebuffer.cpp b/src/driver/framebuffer.cpp index 38030c3c1..5029090a9 100644 --- a/src/driver/framebuffer.cpp +++ b/src/driver/framebuffer.cpp @@ -1808,8 +1808,17 @@ void CFrameBuffer::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32 d2 = (fb_pixel_t *) d; for (int count2 = 0; count2 < xc; count2++ ) { fb_pixel_t pix = *(pixpos + xp); - if (!transp || (pix != 0)) { + if (!transp || (pix & 0xff000000) == 0xff000000) *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++; pixpos++;