diff options
author | Robin Watts <robin.watts@artifex.com> | 2014-03-17 17:37:28 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2014-03-17 19:37:48 +0000 |
commit | 8fdcb140930c3027841af28a4632ce6d23aa44b6 (patch) | |
tree | 498e429e7366c58b7ac0e62f38e242a89c414bb5 /source/fitz | |
parent | 3f88a10ad8fc3da8c582c4524225e59cdfff12e5 (diff) | |
download | mupdf-8fdcb140930c3027841af28a4632ce6d23aa44b6.tar.xz |
Ensure that small images don't subdivide more than they should.
Gridfitting can increase the required width/height of images by up to
2 pixels. This makes images that are rendered very small very
sensitive to over quantisation.
This can produce 'mushier' images than it should, for instance on
tests/Ghent_V3.0/090_Font-Support_x3.pdf (pgmraw, 72dpi)
Diffstat (limited to 'source/fitz')
-rw-r--r-- | source/fitz/image.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/fitz/image.c b/source/fitz/image.c index 3cfe0e8b..54889b1c 100644 --- a/source/fitz/image.c +++ b/source/fitz/image.c @@ -243,11 +243,14 @@ fz_image_get_pixmap(fz_context *ctx, fz_image *image, int w, int h) if (h < 0 || h > image->h) h = image->h; - /* What is our ideal factor? */ + /* What is our ideal factor? We search for the largest factor where + * we can subdivide and stay larger than the required size. We add + * a fudge factor of +2 here to allow for the possibility of + * expansion due to grid fitting. */ if (w == 0 || h == 0) l2factor = 0; else - for (l2factor=0; image->w>>(l2factor+1) >= w && image->h>>(l2factor+1) >= h && l2factor < 8; l2factor++); + for (l2factor=0; image->w>>(l2factor+1) >= w+2 && image->h>>(l2factor+1) >= h+2 && l2factor < 8; l2factor++); /* Can we find any suitable tiles in the cache? */ key.refs = 1; |