From bd67f3dc6b87023f5d4699985b90e087807d59ac Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Mon, 11 Feb 2013 07:16:58 +0100 Subject: bitmap drawing: Support alpha blend if image over the framebuffer contents. If DRMODE_FG now the alpha channel in bitmaps can be used to draw the bitmap over the framebuffer, so that e.g. a line selector isn't cleared for for transparent bitmap pixels. Change-Id: I09d59a09d2f3c90450a0fe2b83c6c59d757b686b --- firmware/drivers/lcd-16bit-common.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'firmware/drivers/lcd-16bit-common.c') diff --git a/firmware/drivers/lcd-16bit-common.c b/firmware/drivers/lcd-16bit-common.c index 7f6a51790d..423ea183dc 100644 --- a/firmware/drivers/lcd-16bit-common.c +++ b/firmware/drivers/lcd-16bit-common.c @@ -930,14 +930,12 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, drmode &= DRMODE_SOLID; /* mask out inversevid */ } if (drmode == DRMODE_BG) - { dmask = ~dmask; - } - /* Set to DRMODE_BG as we use its code path in the switch below */ + /* If drawmode is FG use a separate special case that blends the image + * onto the current framebuffer contents. Otherwise BG is forced that + * blends the image with the backdrop (if any, otherwise background color )*/ if (image != NULL) - { - drmode = DRMODE_BG; - } + drmode = (drmode == DRMODE_FG) ? DRMODE_FG|DRMODE_INT_MOD : DRMODE_BG; /* Use extra bit to avoid if () in the switch-cases below */ if ((drmode & DRMODE_BG) && lcd_backdrop) drmode |= DRMODE_INT_MOD; @@ -1049,6 +1047,16 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, } while (--col); break; + case DRMODE_FG|DRMODE_INT_MOD: + do + { + *dst = blend_two_colors(*dst, *image, data & ALPHA_COLOR_LOOKUP_SIZE ); + dst += COL_INC; + image += STRIDE_MAIN(1, stride_image); + UPDATE_SRC_ALPHA; + } + while (--col); + break; case DRMODE_FG: fg = current_vp->fg_pattern; do -- cgit v1.2.3