Evas fonts: Fix minor deviation in RLE font render

So I've discovered some weird output values after drawing
some text. The destination alpha would become 0xFE even
when the back buffer had a background with 0xFF alpha.

Example:
Dest is 0xff00ff00 (green).
Color is 0xffffffff (white).
Current font alpha is 170 (0xaa).
--> Output was 0xFEaaFEaa instead of 0xFFaaFFaa.

This is because of some slightly invalid calculation
when doing the font masking (mtab[v] = 0x55 above).

Indeed, MUL_256 takes alpha values in the range [1-256]
and not [0-256] as was assumed.
This commit is contained in:
Jean-Philippe Andre 2015-01-06 19:15:07 +09:00
parent c57fa54fc8
commit a90876c337
1 changed files with 1 additions and 3 deletions

View File

@ -488,7 +488,6 @@ evas_common_font_glyph_draw(RGBA_Font_Glyph *fg,
DATA32 *dst = dst_image->image.data;
DATA32 coltab[16], col;
DATA16 mtab[16], v;
DATA8 tmp;
w = fgo->bitmap.width; h = fgo->bitmap.rows;
// skip if totally clipped out
@ -533,8 +532,7 @@ evas_common_font_glyph_draw(RGBA_Font_Glyph *fg,
{
v = (i << 4) | i;
coltab[i] = MUL_SYM(v, col);
tmp = (coltab[i] >> 24);
mtab[i] = 256 - (tmp + (tmp >> 7));
mtab[i] = 256 - (coltab[i] >> 24);
}
#ifdef BUILD_MMX
if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))