for (xpos = 0; xpos < state->number_of_cells; xpos++) {
if (state->current_generation[xpos] == True) {
XFillRectangle(state->dpy, state->evolution_history, state->gc, xpos*state->pixel_size, state->ypos, state->pixel_size, state->pixel_size);
+ } else {
+ XSetForeground(state->dpy, state->gc, state->bg);
+ XFillRectangle(state->dpy, state->evolution_history, state->gc, xpos*state->pixel_size, state->ypos, state->pixel_size, state->pixel_size);
+ XSetForeground(state->dpy, state->gc, state->fg);
}
}
}
state->evolution_history = XCreatePixmap(state->dpy, state->win, state->xlim, state->num_generations*state->pixel_size, xgwa.depth);
// Pixmap contents are undefined after creation. Explicitly set a black
// background by drawing a black rectangle over the entire pixmap.
- XSetForeground(state->dpy, state->gc, state->bg);
+ XColor blackx, blacks;
+ XAllocNamedColor(state->dpy, DefaultColormapOfScreen(DefaultScreenOfDisplay(state->dpy)), "black", &blacks, &blackx);
+ XSetForeground(state->dpy, state->gc, blacks.pixel);
XFillRectangle(state->dpy, state->evolution_history, state->gc, 0, 0, state->xlim, state->num_generations*state->pixel_size);
XSetForeground(state->dpy, state->gc, state->fg);
render_current_generation(state);