X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/puzzles/blobdiff_plain/4e7ef6e6e2e7a7bbc29bdaa2db69ae3956634a68..fbdd76103a405b7be3087cb0bca175fc738cbf27:/windows.c diff --git a/windows.c b/windows.c index 63ee3dd..1fda71b 100644 --- a/windows.c +++ b/windows.c @@ -47,11 +47,21 @@ void frontend_default_colour(frontend *fe, float *output) void draw_rect(frontend *fe, int x, int y, int w, int h, int colour) { - HBRUSH oldbrush = SelectObject(fe->hdc_bm, fe->brushes[colour]); - HPEN oldpen = SelectObject(fe->hdc_bm, fe->pens[colour]); - Rectangle(fe->hdc_bm, x, y, x+w, y+h); - SelectObject(fe->hdc_bm, oldbrush); - SelectObject(fe->hdc_bm, oldpen); + if (w == 1 && h == 1) { + /* + * Rectangle() appears to get uppity if asked to draw a 1x1 + * rectangle, presumably on the grounds that that's beneath + * its dignity and you ought to be using SetPixel instead. + * So I will. + */ + SetPixel(fe->hdc_bm, x, y, fe->colours[colour]); + } else { + HBRUSH oldbrush = SelectObject(fe->hdc_bm, fe->brushes[colour]); + HPEN oldpen = SelectObject(fe->hdc_bm, fe->pens[colour]); + Rectangle(fe->hdc_bm, x, y, x+w, y+h); + SelectObject(fe->hdc_bm, oldbrush); + SelectObject(fe->hdc_bm, oldpen); + } } void draw_line(frontend *fe, int x1, int y1, int x2, int y2, int colour)