summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2013-02-11 07:16:58 +0100
committerThomas Martitz <kugel@rockbox.org>2013-02-12 10:37:13 +0100
commitbd67f3dc6b87023f5d4699985b90e087807d59ac (patch)
tree393544bf7e433a709d6c26095818fd133c5965c1 /firmware/drivers
parent68d3ce2acd44b97516f56c689bffa87bbdfc74c7 (diff)
downloadrockbox-bd67f3dc6b87023f5d4699985b90e087807d59ac.zip
rockbox-bd67f3dc6b87023f5d4699985b90e087807d59ac.tar.gz
rockbox-bd67f3dc6b87023f5d4699985b90e087807d59ac.tar.bz2
rockbox-bd67f3dc6b87023f5d4699985b90e087807d59ac.tar.xz
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
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/lcd-16bit-common.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/firmware/drivers/lcd-16bit-common.c b/firmware/drivers/lcd-16bit-common.c
index 7f6a517..423ea18 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