summaryrefslogtreecommitdiff
path: root/pdf
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-04-16 14:41:02 +0100
committerRobin Watts <robin.watts@artifex.com>2012-04-16 15:02:04 +0100
commit00851c1b04215f2e5688836be57e4efdb198483b (patch)
treef1259576f8e40317ba0cae70b763ee3e95619f25 /pdf
parente6b8d0c6b1809e012da290202108f1ac76153774 (diff)
downloadmupdf-00851c1b04215f2e5688836be57e4efdb198483b.tar.xz
Reduce the changes that mupdfclean makes to floats.
Most of the changes mupdfclean makes to a file are purely textual (streams are decompressed etc), but some objects can undergo changes due to being read in, and then written out. Notably in this class are floats. For instance, the mediabox in Bug689189.pdf contains 2125.984, which when written out with the current code gives 2125.98. This is enough of a difference to cause rendering changes. By upping the precision (instead of %g use, %1.9g) we get better results; we now output 2125.9839, which is much closer (and in fact has the same float representation when read back in). This drastically reduces the differences between a rendering of Bug689189.pdf and the uncompressed version, but we still have differences - in shadings, it seems.
Diffstat (limited to 'pdf')
-rw-r--r--pdf/base_object.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pdf/base_object.c b/pdf/base_object.c
index 6f0c5d99..97cb97cc 100644
--- a/pdf/base_object.c
+++ b/pdf/base_object.c
@@ -1183,7 +1183,7 @@ static void fmt_obj(struct fmt *fmt, pdf_obj *obj)
}
else if (pdf_is_real(obj))
{
- sprintf(buf, "%g", pdf_to_real(obj));
+ sprintf(buf, "%1.9g", pdf_to_real(obj));
if (strchr(buf, 'e')) /* bad news! */
sprintf(buf, fabsf(pdf_to_real(obj)) > 1 ? "%1.1f" : "%1.8f", pdf_to_real(obj));
fmt_puts(fmt, buf);