- int i;
- for (i = 0; i <= bitmap_w; i += grid_size)
- XFillRectangle (dpy, d, gc, xoff+i-border/2, yoff, border, bitmap_h);
- for (i = 0; i <= bitmap_h; i += grid_size)
- XFillRectangle (dpy, d, gc, xoff, yoff+i-border/2, bitmap_w, border);
+ int half = border/2;
+ int half2 = (border & 1 ? half+1 : half);
+ XSetForeground(st->dpy, st->gc, st->bg);
+ for (i = 0; i < st->bitmap_w; i += st->grid_size)
+ {
+ int j;
+ for (j = 0; j < st->bitmap_h; j += st->grid_size)
+ XDrawRectangle (st->dpy, d, st->gc,
+ st->xoff+i+half2, st->yoff+j+half2,
+ st->grid_size-border-1, st->grid_size-border-1);
+ }
+
+ XSetForeground(st->dpy, st->gc, st->fg);
+ for (i = 0; i <= st->bitmap_w; i += st->grid_size)
+ XFillRectangle (st->dpy, d, st->gc, st->xoff+i-half, st->yoff, border, st->bitmap_h);
+ for (i = 0; i <= st->bitmap_h; i += st->grid_size)
+ XFillRectangle (st->dpy, d, st->gc, st->xoff, st->yoff+i-half, st->bitmap_w, border);