From a90876c337422d2da918152b048a0dc0965295d5 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Tue, 6 Jan 2015 19:15:07 +0900 Subject: [PATCH] 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. --- src/lib/evas/common/evas_font_compress.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/lib/evas/common/evas_font_compress.c b/src/lib/evas/common/evas_font_compress.c index 1cbd090..86babd9 100644 --- a/src/lib/evas/common/evas_font_compress.c +++ b/src/lib/evas/common/evas_font_compress.c @@ -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)) -- 2.7.4