1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Thomas Martitz 2013-02-12 10:26:44 +01:00
parent c66a66728c
commit ca634a0ac0
2 changed files with 11 additions and 10 deletions

View file

@ -470,8 +470,9 @@ void output_row_8_native(uint32_t row, void * row_in,
*dest = LCD_RGBPACK_LCD(r, g, b); *dest = LCD_RGBPACK_LCD(r, g, b);
dest += STRIDE_MAIN(1, ctx->bm->height); dest += STRIDE_MAIN(1, ctx->bm->height);
if (bm_alpha) { if (bm_alpha) {
/* pack alpha channel for 2 pixels into 1 byte */ /* pack alpha channel for 2 pixels into 1 byte and negate
unsigned alpha = qp->alpha; * according to the interal alpha channel format */
uint8_t alpha = ~qp->alpha;
if (col%2) if (col%2)
*bm_alpha++ |= alpha&0xf0; *bm_alpha++ |= alpha&0xf0;
else else

View file

@ -788,7 +788,8 @@ void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int heig
* horizontal. E.g row0: pixel0: byte0[0:3], pixel1: byte0[4:7], pixel2: byte1[0:3],... * horizontal. E.g row0: pixel0: byte0[0:3], pixel1: byte0[4:7], pixel2: byte1[0:3],...
* The format is independant of the internal display orientation and color * The format is independant of the internal display orientation and color
* representation, as to support the same font files on all displays. * representation, as to support the same font files on all displays.
* The values go linear from 0 (fully transparent) to 15 (fully opaque). * The values go linear from 0 (fully opaque) to 15 (fully transparent)
* (note how this is the opposite of the alpha channel in the ARGB format).
* *
* This might suggest that rows need to have an even number of pixels. * This might suggest that rows need to have an even number of pixels.
* However this is generally not the case. lcd_alpha_bitmap_part_mix() can deal * 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,
dmask = 0xffffffff; dmask = 0xffffffff;
drmode &= DRMODE_SOLID; /* mask out inversevid */ drmode &= DRMODE_SOLID; /* mask out inversevid */
} }
/* sourcing from an image ignore drawmode.
* Set to DRMODE_BG as we use its code path in the switch below */
if (image != NULL)
{
drmode = DRMODE_BG;
}
if (drmode == DRMODE_BG) if (drmode == DRMODE_BG)
{ {
dmask = ~dmask; dmask = ~dmask;
} }
/* Set to DRMODE_BG as we use its code path in the switch below */
if (image != NULL)
{
drmode = DRMODE_BG;
}
dst_row = FBADDR(x, y); dst_row = FBADDR(x, y);