aboutsummaryrefslogtreecommitdiff
path: root/filling.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2007-02-25 15:57:35 +0000
committerSimon Tatham <anakin@pobox.com>2007-02-25 15:57:35 +0000
commitca96ca1ac9784e09193c3e9cdc8b9f5af017ce5a (patch)
treeba61279196722bef8c321324069eac38f7619ffc /filling.c
parentbc64fc84812903a887b6134b69b317c8b385c323 (diff)
downloadpuzzles-ca96ca1ac9784e09193c3e9cdc8b9f5af017ce5a.zip
puzzles-ca96ca1ac9784e09193c3e9cdc8b9f5af017ce5a.tar.gz
puzzles-ca96ca1ac9784e09193c3e9cdc8b9f5af017ce5a.tar.bz2
puzzles-ca96ca1ac9784e09193c3e9cdc8b9f5af017ce5a.tar.xz
Hardwiring the grid line width to 1 is really bad for printing. Use
a slightly more conventional method of drawing the grid lines, and thereby fix printing. [originally from svn r7335]
Diffstat (limited to 'filling.c')
-rw-r--r--filling.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/filling.c b/filling.c
index 82efcca..fba86e5 100644
--- a/filling.c
+++ b/filling.c
@@ -1122,18 +1122,32 @@ static void draw_square(drawing *dr, game_drawstate *ds, int x, int y,
assert(ds);
/*
+ * Clip to the grid square.
+ */
+ clip(dr, BORDER + x*TILE_SIZE, BORDER + y*TILE_SIZE,
+ TILE_SIZE, TILE_SIZE);
+
+ /*
* Clear the square.
*/
draw_rect(dr,
- BORDER + x*TILE_SIZE + 1,
- BORDER + y*TILE_SIZE + 1,
- TILE_SIZE - 1,
- TILE_SIZE - 1,
+ BORDER + x*TILE_SIZE,
+ BORDER + y*TILE_SIZE,
+ TILE_SIZE,
+ TILE_SIZE,
(flags & CURSOR_BG ? COL_HIGHLIGHT :
flags & ERROR_BG ? COL_ERROR :
flags & CORRECT_BG ? COL_CORRECT : COL_BACKGROUND));
/*
+ * Draw the grid lines.
+ */
+ draw_line(dr, BORDER + x*TILE_SIZE, BORDER + y*TILE_SIZE,
+ BORDER + (x+1)*TILE_SIZE, BORDER + y*TILE_SIZE, COL_GRID);
+ draw_line(dr, BORDER + x*TILE_SIZE, BORDER + y*TILE_SIZE,
+ BORDER + x*TILE_SIZE, BORDER + (y+1)*TILE_SIZE, COL_GRID);
+
+ /*
* Draw the number.
*/
if (n) {
@@ -1209,12 +1223,14 @@ static void draw_square(drawing *dr, game_drawstate *ds, int x, int y,
BORDER_WIDTH,
BORDER_WIDTH,
COL_GRID);
-
+
+ unclip(dr);
+
draw_update(dr,
- BORDER + x*TILE_SIZE - 1,
- BORDER + y*TILE_SIZE - 1,
- TILE_SIZE + 3,
- TILE_SIZE + 3);
+ BORDER + x*TILE_SIZE,
+ BORDER + y*TILE_SIZE,
+ TILE_SIZE,
+ TILE_SIZE);
}
static void draw_grid(drawing *dr, game_drawstate *ds, game_state *state,
@@ -1463,6 +1479,7 @@ static void game_print(drawing *dr, game_state *state, int tilesize)
/*
* Draw grid.
*/
+ print_line_width(dr, TILE_SIZE / 64);
draw_grid(dr, ds, state, NULL, FALSE, borders, FALSE);
/*