forked from enlightenment/efl
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.
This commit is contained in:
parent
378157ba1e
commit
52d117c905
|
@ -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++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue