diff options
author | Thomas Martitz <kugel@rockbox.org> | 2013-02-11 07:16:58 +0100 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2013-02-12 10:37:13 +0100 |
commit | bd67f3dc6b87023f5d4699985b90e087807d59ac (patch) | |
tree | 393544bf7e433a709d6c26095818fd133c5965c1 /firmware/drivers/lcd-16bit-common.c | |
parent | 68d3ce2acd44b97516f56c689bffa87bbdfc74c7 (diff) | |
download | rockbox-bd67f3dc6b87023f5d4699985b90e087807d59ac.tar.gz rockbox-bd67f3dc6b87023f5d4699985b90e087807d59ac.zip |
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/lcd-16bit-common.c')
-rw-r--r-- | firmware/drivers/lcd-16bit-common.c | 20 |
1 files changed, 14 insertions, 6 deletions
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, | |||
930 | drmode &= DRMODE_SOLID; /* mask out inversevid */ | 930 | drmode &= DRMODE_SOLID; /* mask out inversevid */ |
931 | } | 931 | } |
932 | if (drmode == DRMODE_BG) | 932 | if (drmode == DRMODE_BG) |
933 | { | ||
934 | dmask = ~dmask; | 933 | dmask = ~dmask; |
935 | } | 934 | /* If drawmode is FG use a separate special case that blends the image |
936 | /* Set to DRMODE_BG as we use its code path in the switch below */ | 935 | * onto the current framebuffer contents. Otherwise BG is forced that |
936 | * blends the image with the backdrop (if any, otherwise background color )*/ | ||
937 | if (image != NULL) | 937 | if (image != NULL) |
938 | { | 938 | drmode = (drmode == DRMODE_FG) ? DRMODE_FG|DRMODE_INT_MOD : DRMODE_BG; |
939 | drmode = DRMODE_BG; | ||
940 | } | ||
941 | /* Use extra bit to avoid if () in the switch-cases below */ | 939 | /* Use extra bit to avoid if () in the switch-cases below */ |
942 | if ((drmode & DRMODE_BG) && lcd_backdrop) | 940 | if ((drmode & DRMODE_BG) && lcd_backdrop) |
943 | drmode |= DRMODE_INT_MOD; | 941 | drmode |= DRMODE_INT_MOD; |
@@ -1049,6 +1047,16 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, | |||
1049 | } | 1047 | } |
1050 | while (--col); | 1048 | while (--col); |
1051 | break; | 1049 | break; |
1050 | case DRMODE_FG|DRMODE_INT_MOD: | ||
1051 | do | ||
1052 | { | ||
1053 | *dst = blend_two_colors(*dst, *image, data & ALPHA_COLOR_LOOKUP_SIZE ); | ||
1054 | dst += COL_INC; | ||
1055 | image += STRIDE_MAIN(1, stride_image); | ||
1056 | UPDATE_SRC_ALPHA; | ||
1057 | } | ||
1058 | while (--col); | ||
1059 | break; | ||
1052 | case DRMODE_FG: | 1060 | case DRMODE_FG: |
1053 | fg = current_vp->fg_pattern; | 1061 | fg = current_vp->fg_pattern; |
1054 | do | 1062 | do |