From a4fca3286f3aa630a3641e50a8e1f44ab1504a29 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Fri, 21 Apr 2023 15:30:41 +0100 Subject: 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. --- printing.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'printing.c') 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); } -- cgit v1.1