]> git.draconx.ca Git - rrace.git/blobdiff - src/x11.c
Reduce the amount of redundant drawing in the goal area.
[rrace.git] / src / x11.c
index f572616192d6d6400ad95e4c350902d567d09d56..caf35180bb7079c9b8028260c04e36b641837a1c 100644 (file)
--- a/src/x11.c
+++ b/src/x11.c
@@ -134,7 +134,7 @@ redraw_goal_tile(struct app_state *state, Display *display, Drawable d,
        return redraw_tile(state, display, d, gp[0], gp[1], gp[2], x, y, w, h);
 }
 
-void x11_redraw_goal(struct app_state *state)
+void x11_redraw_goal(struct app_state *state, uint_fast32_t mask)
 {
        Display *display = XtDisplay(state->goal);
        Window window = XtWindow(state->goal);
@@ -142,8 +142,20 @@ void x11_redraw_goal(struct app_state *state)
        int i;
 
        XtVaGetValues(state->goal, XmNwidth, &w, XmNheight, &h, (char *)NULL);
-       for (i = 0; i < 9; i++)
-               redraw_goal_tile(state, display, window, i%3, i/3, w/3, h/3);
+       for (i = 0; i < 9; i++) {
+               int x = i%3, y = i/3;
+
+               if (mask & 1) {
+                       redraw_goal_tile(state, display, window,
+                                               x, y, w/3, h/3);
+               }
+
+               /*
+                * Goal bitmaps have a gap of 2 tiles between each row.
+                * This funny shift will accomodate that.
+                */
+               mask >>= 1|x;
+       }
 }
 
 /* Render the goal area as the window's icon */