summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-10-12 19:10:22 +0100
committerRobin Watts <robin.watts@artifex.com>2016-10-12 20:47:08 +0100
commit3c2917d81868629cd784de17693fd896f4841393 (patch)
tree1428509791bcd51c61d79341f09d20e42a905f52 /source
parenta0aa734da4f56ff5d5690bc1229c63a2d712087a (diff)
downloadmupdf-3c2917d81868629cd784de17693fd896f4841393.tar.xz
Optimise fz_new_buffer_from_image_as_png.
This function calls png_from_pixmap, an auxiliary function to do the work. This was done deliberately to allow us to make the optimisation of dropping the pixmap early if it is not required. This keeps the memory use down in the case when a color conversion is required. Sadly, I never appear to have made the trivial change to actually use it in this mode. Do that now.
Diffstat (limited to 'source')
-rw-r--r--source/fitz/output-png.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/source/fitz/output-png.c b/source/fitz/output-png.c
index 960e5292..12eec89f 100644
--- a/source/fitz/output-png.c
+++ b/source/fitz/output-png.c
@@ -292,9 +292,7 @@ fz_new_buffer_from_image_as_png(fz_context *ctx, fz_image *image)
fz_var(buf);
fz_try(ctx)
- buf = png_from_pixmap(ctx, pix, 0);
- fz_always(ctx)
- fz_drop_pixmap(ctx, pix);
+ buf = png_from_pixmap(ctx, pix, 1);
fz_catch(ctx)
fz_rethrow(ctx);
return buf;