summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2006-10-12 07:54:39 +0000
committerRich Felker <dalias@aerifal.cx>2006-10-12 07:54:39 +0000
commit65d1709c918dc981e389d63059954dc5664c8d33 (patch)
tree40d301d0b01dd48ec398fe88397b3523304f4dfb
parent58ece9167987dbc3b88656c470244543cb3d5c32 (diff)
factoring
-rw-r--r--dblbuf.c12
-rw-r--r--refresh.c3
-rw-r--r--uuterm.h3
3 files changed, 13 insertions, 5 deletions
diff --git a/dblbuf.c b/dblbuf.c
index c202e96..570731d 100644
--- a/dblbuf.c
+++ b/dblbuf.c
@@ -106,7 +106,15 @@ static unsigned long expand_color(struct uudisp *d, int color)
return color * (unsigned long)0x0101010101010101;
}
-void uudisp_draw_glyph(struct uudisp *d, int idx, int x, const void *glyph, int color)
+void uudisp_predraw_cell(struct uudisp *d, int idx, int x, int color)
+{
+ struct dblbuf *b = (void *)&d->priv;
+
+ b->slices[idx].colors[2*x] = expand_color(d, color&15);
+ b->slices[idx].colors[2*x+1] = expand_color(d, color>>4) ^ b->slices[idx].colors[2*x];
+}
+
+void uudisp_draw_glyph(struct uudisp *d, int idx, int x, const void *glyph)
{
struct dblbuf *b = (void *)&d->priv;
int i;
@@ -115,8 +123,6 @@ void uudisp_draw_glyph(struct uudisp *d, int idx, int x, const void *glyph, int
unsigned char *src = (void *)glyph;
unsigned char *dest = b->slices[idx].bitmap + cs * x;
- b->slices[idx].colors[2*x] = expand_color(d, color&15);
- b->slices[idx].colors[2*x+1] = expand_color(d, color>>4) ^ b->slices[idx].colors[2*x];
for (i=d->cell_h; i; i--, dest += stride)
*dest |= *src++;
}
diff --git a/refresh.c b/refresh.c
index 7410866..9b5aef6 100644
--- a/refresh.c
+++ b/refresh.c
@@ -52,9 +52,10 @@ void uuterm_refresh_row(struct uudisp *d, struct uurow *row, int x1, int x2)
} else {
width = 1; part = 0; chp = ch[x&3];
}
+ uudisp_predraw_cell(d, row->idx, x, row->cells[x].a & 0xff);
for (i=0; i<sizeof(ch[0]) && chp[i]; i++) {
const void *glyph = lookup_glyph(d->font, i, chp, ch[(x+3)&3], ch[(x+1)&3], width, part);
- if (glyph) uudisp_draw_glyph(d, row->idx, x, glyph, row->cells[x].a & 0xff);
+ if (glyph) uudisp_draw_glyph(d, row->idx, x, glyph);
}
}
}
diff --git a/uuterm.h b/uuterm.h
index 6bda258..3ce390e 100644
--- a/uuterm.h
+++ b/uuterm.h
@@ -92,7 +92,8 @@ int uudisp_fd_set(struct uudisp *, int, void *);
void uudisp_next_event(struct uudisp *, void *);
void uudisp_close(struct uudisp *);
void uudisp_refresh(struct uudisp *, struct uuterm *);
-void uudisp_draw_glyph(struct uudisp *, int, int, const void *, int);
+void uudisp_predraw_cell(struct uudisp *, int, int, int);
+void uudisp_draw_glyph(struct uudisp *, int, int, const void *);
void *uuterm_alloc(size_t);
void uuterm_free(void *);