diff options
Diffstat (limited to 'source/fitz/output-png.c')
-rw-r--r-- | source/fitz/output-png.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/source/fitz/output-png.c b/source/fitz/output-png.c index 38bfa778..d21bc59b 100644 --- a/source/fitz/output-png.c +++ b/source/fitz/output-png.c @@ -86,34 +86,18 @@ static void png_write_icc(fz_context *ctx, png_band_writer *writer, const fz_colorspace *cs) { fz_output *out = writer->super.out; - int size; + size_t size, csize; fz_buffer *buffer = fz_icc_data_from_icc_colorspace(ctx, cs); - unsigned char *data; unsigned char *pos, *cdata, *chunk = NULL; - uLong bound; - uLongf csize; - uLong long_size; - int t; - long_size = (uLong)fz_buffer_storage(ctx, buffer, &data); + /* Deflate the profile */ + cdata = fz_new_deflated_data_from_buffer(ctx, &csize, buffer, FZ_DEFLATE_DEFAULT); - if (!data) + if (!cdata) return; - /* Deflate the profile */ - bound = compressBound(long_size); - cdata = fz_malloc(ctx, bound); - csize = (uLongf)bound; - t = compress(cdata, &csize, data, long_size); - if (t != Z_OK) - { - fz_free(ctx, cdata); - fz_throw(ctx, FZ_ERROR_GENERIC, "cannot deflate icc buffer"); - } size = csize + strlen("MuPDF Profile") + 2; - fz_var(cdata); - fz_try(ctx) { chunk = fz_calloc(ctx, size, 1); |