+ /*
+ * To prevent excessive spinning on redraw during a completion
+ * flash, we first check to see if _either_ the flash
+ * background colour has changed _or_ at least one point has
+ * moved _or_ a drag has begun or ended, and abandon the redraw
+ * if neither is the case.
+ *
+ * Also in this loop we work out the coordinates of all the
+ * points for this redraw.
+ */
+ points_moved = FALSE;
+ for (i = 0; i < state->params.n; i++) {
+ point p = state->pts[i];
+ long x, y;
+
+ if (ui->dragpoint == i)
+ p = ui->newpoint;
+
+ if (oldstate)
+ p = mix(oldstate->pts[i], p, animtime / ui->anim_length);
+
+ x = p.x * ds->tilesize / p.d;
+ y = p.y * ds->tilesize / p.d;
+
+ if (ds->x[i] != x || ds->y[i] != y)
+ points_moved = TRUE;
+
+ ds->x[i] = x;
+ ds->y[i] = y;
+ }
+
+ if (ds->bg == bg && ds->dragpoint == ui->dragpoint && !points_moved)
+ return; /* nothing to do */
+
+ ds->dragpoint = ui->dragpoint;
+ ds->bg = bg;
+