]> git.draconx.ca Git - rrace.git/blobdiff - src/motif_ui.c
x11: Improve redraw of empty spaces.
[rrace.git] / src / motif_ui.c
index 127de061bbc1a84608cfe95a09a953631bc25bb1..fefcfedef7505a6509074f76e5ffe1d2e9d57ecb 100644 (file)
@@ -323,6 +323,8 @@ static void game_expose(Widget w, void *data, void *cb_data)
 {
        XmDrawingAreaCallbackStruct *cbs = cb_data;
        XExposeEvent *e = &cbs->event->xexpose;
+       struct app_state *state = data;
+       uint_least32_t *gp = state->board.game;
        Dimension width, height;
        uint_fast32_t mask;
 
@@ -330,8 +332,15 @@ static void game_expose(Widget w, void *data, void *cb_data)
        if (!(width /= 5) || !(height /= 5))
                return;
 
-       mask = expose_mask(e->x, e->y, e->width, e->height, width, height);
-       x11_redraw_game(data, mask);
+       /*
+        * Only draw exposed nonempty tiles; exposed areas are filled with the
+        * background automatically and thus exposed empty spaces don't need
+        * to be drawn again.
+        */
+       mask = gp[0] | gp[1] | gp[2];
+       mask &= expose_mask(e->x, e->y, e->width, e->height, width, height);
+
+       x11_redraw_game(state, mask);
 }
 
 static void goal_expose(Widget w, void *data, void *cb_data)