diff --git a/einkfb.c b/einkfb.c index 26d19f63a..4227df6d1 100644 --- a/einkfb.c +++ b/einkfb.c @@ -182,19 +182,20 @@ static int blitToFrameBuffer(lua_State *L) { *fbptr &= 0xF0; *fbptr |= *bbptr & 0x0F; fbptr += fb->finfo.line_length; + bbptr += (bb->w / 2); } } else { for(y = 0; y < h; y++) { *fbptr &= 0xF0; - *fbptr |= (*bbptr & 0xF0) >> 4; + *fbptr |= *bbptr >> 4; fbptr += fb->finfo.line_length; + bbptr += (bb->w / 2); } } xdest++; xoffs++; w--; } - w = (w+1) / 2; // we'll always do two pixels at once for now fbptr = (uint8_t*)(fb->data + ydest * fb->finfo.line_length + @@ -205,15 +206,23 @@ static int blitToFrameBuffer(lua_State *L) { if(xoffs & 1) { for(y = 0; y < h; y++) { - for(x = 0; x < w; x++) { - fbptr[x] = (bbptr[x-1] << 4) | ((bbptr[x] & 0xF0) >> 4); + for(x = 0; x < (w / 2); x++) { + fbptr[x] = (bbptr[x] << 4) | (bbptr[x+1] >> 4); + } + if(w & 1) { + fbptr[x] &= 0x0F; + fbptr[x] |= bbptr[x] << 4; } fbptr += fb->finfo.line_length; bbptr += (bb->w / 2); } } else { for(y = 0; y < h; y++) { - memcpy(fbptr, bbptr, w); + memcpy(fbptr, bbptr, w / 2); + if(w & 1) { + fbptr[w/2 + 1] &= 0x0F; + fbptr[w/2 + 1] |= bbptr[w/2 + 1] << 4; + } fbptr += fb->finfo.line_length; bbptr += (bb->w / 2); } diff --git a/ft.c b/ft.c index 6a472dbad..5bbae5841 100644 --- a/ft.c +++ b/ft.c @@ -16,7 +16,7 @@ along with this program. If not, see . */ #include -#include +//#include #include #include #include FT_FREETYPE_H diff --git a/rendertext.lua b/rendertext.lua index ab19dd3ad..13514fc9a 100644 --- a/rendertext.lua +++ b/rendertext.lua @@ -33,6 +33,8 @@ function getglyph(face, facehash, charcode) size = size, g = glyph } + else + glyphcache[hash].age = glyphcache_max_age end return glyphcache[hash].g end @@ -48,6 +50,7 @@ function renderUtf8Text(x, y, face, facehash, text) for uchar in string.gfind(text, "([%z\1-\127\194-\244][\128-\191]*)") do local glyph = getglyph(face, facehash, util.utf8charcode(uchar)) fb:blitFrom(glyph.bb, x + pen_x + glyph.l, y - glyph.t, 0, 0, glyph.bb:getWidth(), glyph.bb:getHeight()) + print(uchar, x + pen_x + glyph.l, y - glyph.t, glyph.bb:getWidth(), glyph.bb:getHeight()) pen_x = pen_x + glyph.ax end end