From 3c2917d81868629cd784de17693fd896f4841393 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Wed, 12 Oct 2016 19:10:22 +0100 Subject: 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. --- source/fitz/output-png.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'source/fitz') 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; -- cgit v1.2.3