From 77827fa39a5e4c618217f022a068140f20a7f9dd Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sun, 15 Oct 2006 19:58:02 +0000 Subject: revert "performance increase" that actually hurt performance on better X servers.. :( some better approach is really needed; at this rate, even client side images would be faster... --- dblbuf.c | 4 ---- refresh.c | 1 - xlib.c | 49 +++++++++++++++++++------------------------------ 3 files changed, 19 insertions(+), 35 deletions(-) diff --git a/dblbuf.c b/dblbuf.c index 6213ced..ee15148 100644 --- a/dblbuf.c +++ b/dblbuf.c @@ -117,10 +117,6 @@ void uudisp_predraw_cell(struct uudisp *d, int idx, int x, int color) b->slices[idx].colors[2*x+1] = expand_color(d, color>>4) ^ b->slices[idx].colors[2*x]; } -void uudisp_finalize_cell(struct uudisp *d, int idx, int x) -{ -} - void uudisp_draw_glyph(struct uudisp *d, int idx, int x, const void *glyph) { struct dblbuf *b = (void *)&d->priv; diff --git a/refresh.c b/refresh.c index 789f7f9..9e3ab57 100644 --- a/refresh.c +++ b/refresh.c @@ -59,7 +59,6 @@ void uuterm_refresh_row(struct uudisp *d, struct uurow *row, int x1, int x2) 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); } - uudisp_finalize_cell(d, row->idx, x); } } diff --git a/xlib.c b/xlib.c index 9078b6e..60d86b1 100644 --- a/xlib.c +++ b/xlib.c @@ -23,9 +23,8 @@ struct priv Window window; XIM im; XIC ic; - GC wingc, cugc, fg, bg, mask_fg, mask_bg; + GC wingc, cugc, bggc, fggc, maskgc; Pixmap pixmap; - Pixmap mask; Pixmap *glyph_cache; int *slices_y; int curs_x, curs_y; @@ -126,21 +125,19 @@ int uudisp_open(struct uudisp *d) resize_window(d, px_w, px_h); - p->mask = XCreatePixmap(p->display, DefaultRootWindow(p->display), - d->cell_w, d->cell_h, 1); - p->wingc = XCreateGC(p->display, p->window, 0, &values); p->cugc = XCreateGC(p->display, p->window, 0, &values); - p->fg = XCreateGC(p->display, p->pixmap, 0, &values); - p->bg = XCreateGC(p->display, p->pixmap, 0, &values); - p->mask_fg = XCreateGC(p->display, p->mask, 0, &values); - p->mask_bg = XCreateGC(p->display, p->mask, 0, &values); - XSetClipMask(p->display, p->fg, p->mask); + p->fggc = XCreateGC(p->display, p->pixmap, 0, &values); + p->bggc = XCreateGC(p->display, p->pixmap, 0, &values); + p->maskgc = XCreateGC(p->display, p->pixmap, 0, &values); XSetFunction(p->display, p->cugc, GXxor); - XSetFunction(p->display, p->mask_fg, GXor); + XSetFunction(p->display, p->fggc, GXor); + XSetFunction(p->display, p->bggc, GXcopy); + XSetFunction(p->display, p->maskgc, GXandInverted); XSetForeground(p->display, p->cugc, WhitePixel(p->display, p->screen)); - XSetForeground(p->display, p->mask_fg, WhitePixel(p->display, p->screen)); - XSetForeground(p->display, p->mask_bg, BlackPixel(p->display, p->screen)); + XSetBackground(p->display, p->fggc, BlackPixel(p->display, p->screen)); + XSetForeground(p->display, p->maskgc, WhitePixel(p->display, p->screen)); + XSetBackground(p->display, p->maskgc, BlackPixel(p->display, p->screen)); npages = (nglyphs+1023) / 1024; // allows up to 64 pixel cell height.. p->glyph_cache = calloc(sizeof(p->glyph_cache[0]), npages); @@ -351,28 +348,20 @@ void uudisp_draw_glyph(struct uudisp *d, int idx, int x, const void *glyph) int gp = g >> 10; g &= 1023; - XCopyArea(p->display, p->glyph_cache[gp], p->mask, p->mask_fg, - 0, g*d->cell_h, d->cell_w, d->cell_h, 0, 0); + XCopyPlane(p->display, p->glyph_cache[gp], p->pixmap, p->maskgc, + 0, g*d->cell_h, d->cell_w, d->cell_h, + x * d->cell_w, idx * d->cell_h, 1); + XCopyPlane(p->display, p->glyph_cache[gp], p->pixmap, p->fggc, + 0, g*d->cell_h, d->cell_w, d->cell_h, + x * d->cell_w, idx * d->cell_h, 1); } void uudisp_predraw_cell(struct uudisp *d, int idx, int x, int color) { struct priv *p = (void *)&d->priv; - - XSetClipOrigin(p->display, p->fg, x*d->cell_w, idx*d->cell_h); - XSetForeground(p->display, p->fg, p->colors[color&15]); - XSetForeground(p->display, p->bg, p->colors[color>>4]); - XFillRectangle(p->display, p->pixmap, p->bg, - x*d->cell_w, idx*d->cell_h, d->cell_w, d->cell_h); - XFillRectangle(p->display, p->mask, p->mask_bg, - 0, 0, d->cell_w, d->cell_h); -} - -void uudisp_finalize_cell(struct uudisp *d, int idx, int x) -{ - struct priv *p = (void *)&d->priv; - XSetClipMask(p->display, p->fg, p->mask); - XFillRectangle(p->display, p->pixmap, p->fg, + XSetForeground(p->display, p->fggc, p->colors[color&15]); + XSetForeground(p->display, p->bggc, p->colors[color>>4]); + XFillRectangle(p->display, p->pixmap, p->bggc, x*d->cell_w, idx*d->cell_h, d->cell_w, d->cell_h); } -- cgit v1.2.1