summaryrefslogtreecommitdiff
path: root/source/fitz/output-png.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-10-17 16:41:59 +0200
committerTor Andersson <tor.andersson@artifex.com>2017-11-01 13:08:56 +0100
commit1dc763159b03cbd4387713f353f26c890d2c0e52 (patch)
treed43c18deeacd70e23d7e353c8f0c074c87419a34 /source/fitz/output-png.c
parentf595e889b91a674eb94db7ca4d832da54f5194cd (diff)
downloadmupdf-1dc763159b03cbd4387713f353f26c890d2c0e52.tar.xz
Add separate fz_close_output step.
Closing flushes output and may throw exceptions. Dropping frees the state and never throws exceptions.
Diffstat (limited to 'source/fitz/output-png.c')
-rw-r--r--source/fitz/output-png.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/source/fitz/output-png.c b/source/fitz/output-png.c
index 709d65f0..59dbba94 100644
--- a/source/fitz/output-png.c
+++ b/source/fitz/output-png.c
@@ -37,6 +37,7 @@ fz_save_pixmap_as_png(fz_context *ctx, fz_pixmap *pixmap, const char *filename)
writer = fz_new_png_band_writer(ctx, out);
fz_write_header(ctx, writer, pixmap->w, pixmap->h, pixmap->n, pixmap->alpha, pixmap->xres, pixmap->yres, 0, pixmap->colorspace, pixmap->seps);
fz_write_band(ctx, writer, pixmap->stride, pixmap->h, pixmap->samples);
+ fz_close_output(ctx, out);
}
fz_always(ctx)
{
@@ -357,6 +358,7 @@ png_from_pixmap(fz_context *ctx, fz_pixmap *pix, const fz_color_params *color_pa
buf = fz_new_buffer(ctx, 1024);
out = fz_new_output_with_buffer(ctx, buf);
fz_write_pixmap_as_png(ctx, out, pix);
+ fz_close_output(ctx, out);
}
fz_always(ctx)
{