summaryrefslogtreecommitdiff
path: root/source/fitz/load-png.c
diff options
context:
space:
mode:
authorSimon Bünzli <zeniko@gmail.com>2014-05-07 15:09:22 +0200
committerSimon Bünzli <zeniko@gmail.com>2014-05-07 15:09:22 +0200
commit45307629cef494a2b35329f16b7a3d09f7da222e (patch)
tree1188ecbcb25dfe69ff414069e9b9de5ac35740e6 /source/fitz/load-png.c
parent6834b1f9181dad2455d56682d7998671a2e79a33 (diff)
downloadmupdf-45307629cef494a2b35329f16b7a3d09f7da222e.tar.xz
Correctly round PNG image resolution
Currently, png_read_phys always rounds the resolution down. Many images have a resolution just slightly shy of 96 DPI and are thus rendered too large when they're resized from 95 to match the required 96 for output.
Diffstat (limited to 'source/fitz/load-png.c')
-rw-r--r--source/fitz/load-png.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/source/fitz/load-png.c b/source/fitz/load-png.c
index 984dbed2..d897b5be 100644
--- a/source/fitz/load-png.c
+++ b/source/fitz/load-png.c
@@ -360,8 +360,8 @@ png_read_phys(struct info *info, unsigned char *p, unsigned int size)
fz_throw(info->ctx, FZ_ERROR_GENERIC, "pHYs chunk is the wrong size");
if (p[8] == 1)
{
- info->xres = getuint(p) * 254 / 10000;
- info->yres = getuint(p + 4) * 254 / 10000;
+ info->xres = (getuint(p) * 254 + 5000) / 10000;
+ info->yres = (getuint(p + 4) * 254 + 5000) / 10000;
}
}