summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/fitz/image.c7
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;