diff --git a/src/lib/evas/common/evas_font_compress.c b/src/lib/evas/common/evas_font_compress.c index 1b8d63114b..66c8511907 100644 --- a/src/lib/evas/common/evas_font_compress.c +++ b/src/lib/evas/common/evas_font_compress.c @@ -151,6 +151,9 @@ compress_rle4(DATA8 *src, int pitch, int w, int h, int *size_ret) { // we only need upper 4 bits of value for span creation DATA8 v = pix[x] >> 4; + // round-up if closer to upper value + if ((pix[x] & 0x8) && (v != 0xF)) + v++; // if the current pixel value (in 4bit) is not the same as the // span value (n 4 bit) OR... if the span now exceeds 16 pixels // then add/write out the span to our RLE span blob @@ -344,7 +347,11 @@ compress_bpp4(DATA8 *src, int pitch, int w, int h, int *size_ret) // 4 bits only needed) and pack for (x = 0; x < (w - 1); x += 2) { - *d = (s[0] & 0xf0) | (s[1] >> 4); + DATA8 v1 = s[0] >> 4; + DATA8 v2 = s[1] >> 4; + if ((s[0] & 0x08) && (v1 != 0x0f)) v1++; + if ((s[1] & 0x08) && (v2 != 0x0f)) v2++; + *d = (v1 << 4) | v2; s += 2; d++; }