From 0fe28fd69dd15006ccd684d563699420aadde61a Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Tue, 3 Oct 2006 01:37:17 +0000 Subject: first working version of uuterm! - at this point it is purely experimental. only ascii characters are visible (using builtin font) although all characters are processed. - there are known bugs, including crashes. - there are major missing features. - but it works. ^_^ --- refresh.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 refresh.c (limited to 'refresh.c') diff --git a/refresh.c b/refresh.c new file mode 100644 index 0000000..b1766d2 --- /dev/null +++ b/refresh.c @@ -0,0 +1,45 @@ +/* uuterm, Copyright (C) 2006 Rich Felker; licensed under GNU GPL v2 only */ + +#include "uuterm.h" + +static void extract_cell(unsigned *ch, struct uucell *cell) +{ + int i; + unsigned b; + for (b=i=0; i<3; i++) b |= cell->c[i] << 8*i; + ch[0] = b; + ch -= 2; + for (; ic)+1 && cell->c[i]; i++) + ch[i] = uu_combine_involution(b, cell->c[i]); + if (cell->a & UU_ATTR_UL) + ch[i++] = '_'; //0x0332; + for (; ic)+1; i++) + ch[i] = 0; +} + +const void *ascii_get_glyph(unsigned); + +static const void *lookup_glyph(unsigned *this, int i, unsigned *prev, unsigned *next) +{ + return ascii_get_glyph(this[i]); +} + +void uuterm_refresh_row(struct uudisp *d, struct uurow *row, int x1, int x2) +{ + unsigned ch[4][sizeof(row->cells[0].c)+1]; + int x, i; + + if (x1) extract_cell(ch[(x1-1)&3], &row->cells[x1-1]); + else memset(ch[3], 0, sizeof(ch[3])); + extract_cell(ch[x1&3], &row->cells[x1]); + + for (x=x1; x<=x2; x++) { + extract_cell(ch[(x+1)&3], &row->cells[x+1]); + for (i=0; iidx, x, glyph, row->cells[x].a); + } + } +} + + -- cgit v1.2.3