diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-03-21 20:28:54 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-03-21 20:32:26 +0000 |
commit | 8f7f4981d031ffa907cdfd2767438276ebb6ae7c (patch) | |
tree | 2f5ca6387c225ead0dad3a7f6cc5d9b9f7a63e45 /source/fitz | |
parent | e5eb6ade2cfbc3493d4462b4aa8c92bd26f7a0c8 (diff) | |
download | mupdf-8f7f4981d031ffa907cdfd2767438276ebb6ae7c.tar.xz |
Bug 696668: Update the downscaling logic.
An l2factor of 3 is equivalent to downscaling by a factor of 8.
We can get an l2factor of 3 downscale out of the jpeglib. We can
reasonably downscale by a further l2factor of 3 manually. Any more
than that and we start to completely drop pixels without them
having any effect.
Therefore it's pointless us keeping any tiles around with l2factors
> 6.
Fix the bug (which was that we were using < instead of <=) and
update the value to a more reasonable one anyway.
Diffstat (limited to 'source/fitz')
-rw-r--r-- | source/fitz/image.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/fitz/image.c b/source/fitz/image.c index a2f4bed2..81bb5575 100644 --- a/source/fitz/image.c +++ b/source/fitz/image.c @@ -318,7 +318,7 @@ fz_get_pixmap_from_image(fz_context *ctx, fz_image *image, int w, int h) if (w == 0 || h == 0) l2factor = 0; else - for (l2factor=0; image->w>>(l2factor+1) >= w+2 && image->h>>(l2factor+1) >= h+2 && l2factor < 8; l2factor++); + for (l2factor=0; image->w>>(l2factor+1) >= w+2 && image->h>>(l2factor+1) >= h+2 && l2factor < 6; l2factor++); /* Can we find any suitable tiles in the cache? */ key.refs = 1; @@ -339,7 +339,7 @@ fz_get_pixmap_from_image(fz_context *ctx, fz_image *image, int w, int h) tile = image->get_pixmap(ctx, image, w, h, &l2factor_remaining); /* l2factor_remaining is updated to the amount of subscaling left to do */ - assert(l2factor_remaining >= 0 && l2factor_remaining < 8); + assert(l2factor_remaining >= 0 && l2factor_remaining <= 6); if (l2factor_remaining) { fz_subsample_pixmap(ctx, tile, l2factor_remaining); |