diff --git a/dat.h b/dat.h index 3546903..fb34450 100644 --- a/dat.h +++ b/dat.h @@ -27,9 +27,9 @@ enum { Maxclients = 64, Maxkouho = 32, - Maxdisp = 8, - Imgw = 512, - Imgh = Maxdisp * Fontsz + 8, + Maxdisp = 9, + Imgw = (Maxrunes + 3) * Fontsz, + Imgh = (Maxdisp + 1) * Fontsz, Colfg = 0x000000, Colbg = 0xffffff, diff --git a/win.c b/win.c index f535b39..b588405 100644 --- a/win.c +++ b/win.c @@ -78,17 +78,26 @@ drawstr(u32int *buf, int x, int y, Rune *r, int n, int maxw, int maxh) } } +static void +fill(u32int *buf, int n, u32int color) +{ + int i; + + for(i = 0; i < n; i++) + buf[i] = color; +} + static void drawkouho(Drawcmd *dc, int first, int n, int w, int h) { int sely, y, i; Str *s; - memset(img, (uchar)Colbg, w * h * sizeof(u32int)); + fill(img, w * h, Colbg); drawstr(img, 0, 0, dc->pre.r, dc->pre.n, w, h); if(dc->sel >= 0){ sely = Fontsz + dc->sel * Fontsz; - memset(img + sely * w, (uchar)Colsel, Fontsz * w * sizeof(u32int)); + fill(img + sely * w, Fontsz * w, Colsel); } for(i = 0, y = Fontsz; i < n; i++, y += Fontsz){ s = &dc->kouho[first+i];