summaryrefslogtreecommitdiff
path: root/raster
diff options
context:
space:
mode:
authorGlenn Kennard <glenn.kennard@gmail.com>2008-03-19 17:13:26 +0100
committerGlenn Kennard <glenn.kennard@gmail.com>2008-03-19 17:13:26 +0100
commitb2e958214b88b18f8319885cdc80a8a3be0ce08a (patch)
tree920a80d19236d2a9d9ed0d5023aa013a1823dbbd /raster
parent1daa95159d0419fc37167077b5148d2a711da0b8 (diff)
downloadmupdf-b2e958214b88b18f8319885cdc80a8a3be0ce08a.tar.xz
Optimize pdf_loadtile for indexed images
Diffstat (limited to 'raster')
-rw-r--r--raster/render.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/raster/render.c b/raster/render.c
index 6df46c37..6a69308b 100644
--- a/raster/render.c
+++ b/raster/render.c
@@ -375,7 +375,7 @@ 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), dy);
+ int tileheight = MAX(512*1024/(image->w * image->n), dy);
if ((dx != 1 || dy != 1) && image->h > tileheight) {
int y = 0;
@@ -386,6 +386,8 @@ DEBUG("image %dx%d %d+%d %s\n{\n", image->w, image->h, image->n, image->a, image
return error;
error = fz_newscaledpixmap(&temp, image->w, image->h, image->n + 1, dx, dy);
+ if (error)
+ goto cleanup;
do {
if (y + tileheight > image->h)
@@ -396,14 +398,11 @@ DEBUG("image %dx%d %d+%d %s\n{\n", image->w, image->h, image->n, image->a, image
0, y, image->w, tileheight, dx, dy);
error = image->loadtile(image, tile);
if (error)
- goto cleanup;
+ goto cleanup1;
error = fz_scalepixmaptile(temp, 0, y, tile, dx, dy);
- if (error) {
- if (temp)
- fz_droppixmap(temp);
- goto cleanup;
- }
+ if (error)
+ goto cleanup1;
y += tileheight;
} while (y < image->h);
@@ -511,6 +510,8 @@ DEBUG("}\n");
fz_droppixmap(tile);
return nil;
+cleanup1:
+ fz_droppixmap(temp);
cleanup:
fz_droppixmap(tile);
return error;