From fe2d1608c1f2f11f89e29e3a6e4413e737ab40c7 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Mon, 12 Sep 2016 12:06:53 +0100 Subject: Correct rounding in gproof skeleton files. In the gproof pipeline MuPDF first generates a skeleton file with page sizes in. Then it gets gs to generate individual pages for that file. In one case, the pdf file has a height of 203.4 - at 300dpi that's 847.5 device pixels. MuPDF was rounding that up to 848pixels, whereas gs was rounding it down to 847, causing an error on load. Adjust MuPDFs skeleton file generation so that it matches gs. --- source/gprf/gprf-skeleton.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source/gprf/gprf-skeleton.c') diff --git a/source/gprf/gprf-skeleton.c b/source/gprf/gprf-skeleton.c index 25ee00d9..8393ff0f 100644 --- a/source/gprf/gprf-skeleton.c +++ b/source/gprf/gprf-skeleton.c @@ -41,8 +41,9 @@ fz_save_gproof(fz_context *ctx, const char *pdf_file, fz_document *doc, const ch fz_drop_page(ctx, page); page = NULL; - w = (int)((rect.x1 - rect.x0) * res / 72.0 + 0.5); - h = (int)((rect.y1 - rect.y0) * res / 72.0 + 0.5); + /* Same lack of rounding as gs uses */ + w = (int)((rect.x1 - rect.x0) * res / 72.0); + h = (int)((rect.y1 - rect.y0) * res / 72.0); fz_write_int32_le(ctx, out, w); fz_write_int32_le(ctx, out, h); } -- cgit v1.2.3