UI change to Filling: allow multiple squares to be set at once.
[sgt/puzzles] / misc.c
diff --git a/misc.c b/misc.c
index 91778d8..d3ab815 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -167,14 +167,12 @@ unsigned char *hex2bin(const char *in, int outlen)
     return ret;
 }
 
-void game_mkhighlight(frontend *fe, float *ret,
-                      int background, int highlight, int lowlight)
+void game_mkhighlight_specific(frontend *fe, float *ret,
+                              int background, int highlight, int lowlight)
 {
     float max;
     int i;
 
-    frontend_default_colour(fe, &ret[background * 3]);
-
     /*
      * Drop the background colour so that the highlight is
      * noticeably brighter than it while still being under 1.
@@ -194,6 +192,13 @@ void game_mkhighlight(frontend *fe, float *ret,
     }
 }
 
+void game_mkhighlight(frontend *fe, float *ret,
+                      int background, int highlight, int lowlight)
+{
+    frontend_default_colour(fe, &ret[background * 3]);
+    game_mkhighlight_specific(fe, ret, background, highlight, lowlight);
+}
+
 static void memswap(void *av, void *bv, int size)
 {
     char tmpbuf[512];
@@ -222,14 +227,21 @@ void shuffle(void *array, int nelts, int eltsize, random_state *rs)
     }
 }
 
-void draw_rect_outline(frontend *fe, int x, int y, int w, int h, int colour)
+void draw_rect_outline(drawing *dr, int x, int y, int w, int h, int colour)
 {
     int x0 = x, x1 = x+w-1, y0 = y, y1 = y+h-1;
-
-    draw_line(fe, x0, y0, x0, y1, colour);
-    draw_line(fe, x0, y1, x1, y1, colour);
-    draw_line(fe, x1, y1, x1, y0, colour);
-    draw_line(fe, x1, y0, x0, y0, colour);
+    int coords[8];
+
+    coords[0] = x0;
+    coords[1] = y0;
+    coords[2] = x0;
+    coords[3] = y1;
+    coords[4] = x1;
+    coords[5] = y1;
+    coords[6] = x1;
+    coords[7] = y0;
+
+    draw_polygon(dr, coords, 4, -1, colour);
 }
 
 /* vim: set shiftwidth=4 tabstop=8: */