diff options
author | Thomas Martitz <kugel@rockbox.org> | 2013-02-12 10:26:44 +0100 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2013-02-12 10:29:25 +0100 |
commit | ca634a0ac0877c60417182d6415f159fefd6ad9d (patch) | |
tree | 99525e3648b2766d18990f3bf9b45d1d695cd4a9 /firmware/drivers | |
parent | c66a66728c855456a465a57504344038b3224dd9 (diff) | |
download | rockbox-ca634a0ac0877c60417182d6415f159fefd6ad9d.tar.gz rockbox-ca634a0ac0877c60417182d6415f159fefd6ad9d.zip |
bitmap drawing: Negate alpha channel to match alpha information format of font files.
The comment about the format was actually incorrect. The alpha information
is now negated during conversion to native format, according to the
corrected comment.
Change-Id: Ifdb9ffdf9b55e39e64983eec2d9d60339e570bd9
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/lcd-16bit-common.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/firmware/drivers/lcd-16bit-common.c b/firmware/drivers/lcd-16bit-common.c index 06bb0a25fd..86cb5eadd1 100644 --- a/firmware/drivers/lcd-16bit-common.c +++ b/firmware/drivers/lcd-16bit-common.c | |||
@@ -782,13 +782,14 @@ void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int heig | |||
782 | 782 | ||
783 | /* About Rockbox' internal alpha channel format (for ALPHA_COLOR_FONT_DEPTH == 2) | 783 | /* About Rockbox' internal alpha channel format (for ALPHA_COLOR_FONT_DEPTH == 2) |
784 | * | 784 | * |
785 | * For each pixel, 4bit of alpha information is stored in a byte-stream, | 785 | * For each pixel, 4bit of alpha information is stored in a byte-stream, |
786 | * so two pixels are packed into one byte. | 786 | * so two pixels are packed into one byte. |
787 | * The lower nibble is the first pixel, the upper one the second. The stride is | 787 | * The lower nibble is the first pixel, the upper one the second. The stride is |
788 | * horizontal. E.g row0: pixel0: byte0[0:3], pixel1: byte0[4:7], pixel2: byte1[0:3],... | 788 | * horizontal. E.g row0: pixel0: byte0[0:3], pixel1: byte0[4:7], pixel2: byte1[0:3],... |
789 | * The format is independant of the internal display orientation and color | 789 | * The format is independant of the internal display orientation and color |
790 | * representation, as to support the same font files on all displays. | 790 | * representation, as to support the same font files on all displays. |
791 | * The values go linear from 0 (fully transparent) to 15 (fully opaque). | 791 | * The values go linear from 0 (fully opaque) to 15 (fully transparent) |
792 | * (note how this is the opposite of the alpha channel in the ARGB format). | ||
792 | * | 793 | * |
793 | * This might suggest that rows need to have an even number of pixels. | 794 | * This might suggest that rows need to have an even number of pixels. |
794 | * However this is generally not the case. lcd_alpha_bitmap_part_mix() can deal | 795 | * However this is generally not the case. lcd_alpha_bitmap_part_mix() can deal |
@@ -935,16 +936,15 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, | |||
935 | dmask = 0xffffffff; | 936 | dmask = 0xffffffff; |
936 | drmode &= DRMODE_SOLID; /* mask out inversevid */ | 937 | drmode &= DRMODE_SOLID; /* mask out inversevid */ |
937 | } | 938 | } |
938 | /* sourcing from an image ignore drawmode. | ||
939 | * Set to DRMODE_BG as we use its code path in the switch below */ | ||
940 | if (image != NULL) | ||
941 | { | ||
942 | drmode = DRMODE_BG; | ||
943 | } | ||
944 | if (drmode == DRMODE_BG) | 939 | if (drmode == DRMODE_BG) |
945 | { | 940 | { |
946 | dmask = ~dmask; | 941 | dmask = ~dmask; |
947 | } | 942 | } |
943 | /* Set to DRMODE_BG as we use its code path in the switch below */ | ||
944 | if (image != NULL) | ||
945 | { | ||
946 | drmode = DRMODE_BG; | ||
947 | } | ||
948 | 948 | ||
949 | dst_row = FBADDR(x, y); | 949 | dst_row = FBADDR(x, y); |
950 | 950 | ||