diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-09-12 12:06:53 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-09-12 12:10:15 +0100 |
commit | fe2d1608c1f2f11f89e29e3a6e4413e737ab40c7 (patch) | |
tree | fa0bb07333d429daf8f92297a63a8de35b101445 | |
parent | 85f03730a3ff376114580d9c1f35b95a45ad3705 (diff) | |
download | mupdf-fe2d1608c1f2f11f89e29e3a6e4413e737ab40c7.tar.xz |
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.
-rw-r--r-- | source/gprf/gprf-skeleton.c | 5 |
1 files changed, 3 insertions, 2 deletions
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); } |