summaryrefslogtreecommitdiff
path: root/raster/render.c
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2008-07-01 01:22:51 +0200
committerTor Andersson <tor@ghostscript.com>2008-07-01 01:22:51 +0200
commit8c018dd9c020e33aaf0cd520b3f89c3018dbb423 (patch)
tree539ed62a44bc224c1db97c935cda241f72e84d80 /raster/render.c
parentd4028cf9448d7e7b85b2c41442edbd9ab8c721cc (diff)
downloadmupdf-8c018dd9c020e33aaf0cd520b3f89c3018dbb423.tar.xz
Fix band height calculation bug.
Diffstat (limited to 'raster/render.c')
-rw-r--r--raster/render.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/raster/render.c b/raster/render.c
index d2532971..c7d836c8 100644
--- a/raster/render.c
+++ b/raster/render.c
@@ -413,8 +413,11 @@ DEBUG("image %dx%d %d+%d %s\n{\n", image->w, image->h, image->n, image->a, image
calcimagescale(ctm, image->w, image->h, &dx, &dy);
- /* y-banded loading/scaling of image, more cache-friendly */
- tileheight = MAX(512*1024/(image->w * (image->n + image->a)), dy);
+ /* try to fit tile into a typical L2 cachce */
+ tileheight = 512 * 1024 / (image->w * (image->n + image->a));
+ /* tileheight must be an even multiple of dy, except for last band */
+ tileheight = (tileheight + dy - 1) / dy * dy;
+
if ((dx != 1 || dy != 1) && image->h > tileheight) {
int y = 0;