From 8c018dd9c020e33aaf0cd520b3f89c3018dbb423 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 1 Jul 2008 01:22:51 +0200 Subject: Fix band height calculation bug. --- raster/render.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'raster/render.c') 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; -- cgit v1.2.3