jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=52d117c90501c5cec32248b4231f8f44735bdcf9

commit 52d117c90501c5cec32248b4231f8f44735bdcf9
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Mon Dec 8 13:50:44 2014 +0900

    Evas font: Compress font algo should round instead of floor
    
    This is an attempt at having higher quality font rendering
    while still using RLE-based font compression.
---
 src/lib/evas/common/evas_font_compress.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/lib/evas/common/evas_font_compress.c 
b/src/lib/evas/common/evas_font_compress.c
index 1b8d631..66c8511 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++;
           }

-- 


Reply via email to