aboutsummaryrefslogtreecommitdiff
path: root/printing.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2023-04-21 15:30:41 +0100
committerSimon Tatham <anakin@pobox.com>2023-04-21 16:18:04 +0100
commita4fca3286f3aa630a3641e50a8e1f44ab1504a29 (patch)
tree43ff6e5c34d83b607b4ac3bc42b886a300cbaa5d /printing.c
parentec2e2f37703e1da4bb097c27ae5e7f1fa368624b (diff)
downloadpuzzles-a4fca3286f3aa630a3641e50a8e1f44ab1504a29.zip
puzzles-a4fca3286f3aa630a3641e50a8e1f44ab1504a29.tar.gz
puzzles-a4fca3286f3aa630a3641e50a8e1f44ab1504a29.tar.bz2
puzzles-a4fca3286f3aa630a3641e50a8e1f44ab1504a29.tar.xz
Pass a game_ui to compute_size, print_size and print.
I'm about to move some of the bodgy getenv-based options so that they become fields in game_ui. So these functions, which could previously access those options directly via getenv, will now need to be given a game_ui where they can look them up.
Diffstat (limited to 'printing.c')
-rw-r--r--printing.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/printing.c b/printing.c
index d1a3bad..7301ba0 100644
--- a/printing.c
+++ b/printing.c
@@ -96,7 +96,11 @@ static void get_puzzle_size(const document *doc, struct puzzle *pz,
float ww, hh, ourscale;
/* Get the preferred size of the game, in mm. */
- pz->game->print_size(pz->par, &ww, &hh);
+ {
+ game_ui *ui = pz->game->new_ui(pz->st);
+ pz->game->print_size(pz->par, ui, &ww, &hh);
+ pz->game->free_ui(ui);
+ }
/* Adjust for user-supplied scale factor. */
ourscale = doc->userscale;
@@ -270,9 +274,14 @@ void document_print_page(const document *doc, drawing *dr, int page_nr)
* permit each game to choose its own?)
*/
tilesize = 512;
- pz->game->compute_size(pz->par, tilesize, &pixw, &pixh);
- print_begin_puzzle(dr, xm, xc, ym, yc, pixw, pixh, w, scale);
- pz->game->print(dr, pass == 0 ? pz->st : pz->st2, tilesize);
+ {
+ game_ui *ui = pz->game->new_ui(pz->st);
+ pz->game->compute_size(pz->par, tilesize, ui,
+ &pixw, &pixh);
+ print_begin_puzzle(dr, xm, xc, ym, yc, pixw, pixh, w, scale);
+ pz->game->print(dr, pass == 0 ? pz->st : pz->st2, ui, tilesize);
+ pz->game->free_ui(ui);
+ }
print_end_puzzle(dr);
}