X-Git-Url: https://git.draconx.ca/gitweb/rrace.git/blobdiff_plain/e63b5c4d1965ee2ea238441ed0dba468f64da137..320851f215662265a2ab323c2bc7424e1b6acd33:/src/x11.c diff --git a/src/x11.c b/src/x11.c index 955b939..0a9bef0 100644 --- a/src/x11.c +++ b/src/x11.c @@ -31,6 +31,11 @@ /* Size of the traditional icon pixmap (multiple of 3) */ #define ICON_SIZE 48 +/* Define to 1 to add highlights and delays for visually debugging redraws */ +#if X11_RENDER_DEBUG +# include +#endif + enum { NUM_TILE_COLOURS = COLOUR_MAX*(TILE_MAX-1), COLOUR_UI_GAMEBG = NUM_TILE_COLOURS, @@ -167,7 +172,7 @@ redraw_goal_tile(struct app_state *state, Display *display, Drawable d, void x11_redraw_goal(struct app_state *state, uint_fast32_t mask) { Display *display = XtDisplay(state->goal); - Window window = XtWindow(state->goal); + Window goal = XtWindow(state->goal); Dimension w, h; int i; @@ -176,8 +181,14 @@ void x11_redraw_goal(struct app_state *state, uint_fast32_t mask) int x = i%3, y = i/3; if (mask & 1) { - redraw_goal_tile(state, display, window, - x, y, w/3, h/3); +#if X11_RENDER_DEBUG + XRectangle r = { w/3*(i%3), w/3*(i/3), w/3, h/3 }; + XSetForeground(display, state->tile_gc, 0xff0000); + XFillRectangles(display, goal, state->tile_gc, &r, 1); + XFlush(display); + usleep(70000); +#endif + redraw_goal_tile(state, display, goal, x, y, w/3, h/3); } /* @@ -264,6 +275,13 @@ void x11_redraw_game(struct app_state *state, uint_fast32_t mask) for (i = 0; i < 25; i++) { if (mask & 1) { +#if X11_RENDER_DEBUG + XRectangle r = { w*(i%5), w*(i/5), w, h }; + XSetForeground(display, state->tile_gc, 0xff0000); + XFillRectangles(display, game, state->tile_gc, &r, 1); + XFlush(display); + usleep(70000); +#endif redraw_tile(state, display, game, gp[0], gp[1], gp[2], i%5, i/5, w, h);