From 49b6c0f132ec4624e50cd79660143624dd1fcd35 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Thu, 9 Mar 2017 12:41:57 -0600 Subject: Simplify fz_band_writer API. Remove needless parameter passing in fz_band_writer API. We always know the bandstart, so why make the caller keep track of it and pass it in? Similarly, we know when we hit the end of the page, so why require us to trigger the trailer writing manually? --- source/fitz/output-pnm.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'source/fitz/output-pnm.c') diff --git a/source/fitz/output-pnm.c b/source/fitz/output-pnm.c index 68f25bcb..299c9e47 100644 --- a/source/fitz/output-pnm.c +++ b/source/fitz/output-pnm.c @@ -123,9 +123,8 @@ void fz_write_pixmap_as_pnm(fz_context *ctx, fz_output *out, fz_pixmap *pixmap) { fz_band_writer *writer = fz_new_pnm_band_writer(ctx, out); - fz_write_header(ctx, writer, pixmap->w, pixmap->h, pixmap->n, pixmap->alpha, 0, 0, 1); - fz_write_band(ctx, writer, pixmap->stride, 0, pixmap->h, pixmap->samples); - fz_write_trailer(ctx, writer); + fz_write_header(ctx, writer, pixmap->w, pixmap->h, pixmap->n, pixmap->alpha, 0, 0, 0); + fz_write_band(ctx, writer, pixmap->stride, pixmap->h, pixmap->samples); fz_drop_band_writer(ctx, writer); } @@ -140,9 +139,8 @@ fz_save_pixmap_as_pnm(fz_context *ctx, fz_pixmap *pixmap, char *filename) fz_try(ctx) { writer = fz_new_pnm_band_writer(ctx, out); - fz_write_header(ctx, writer, pixmap->w, pixmap->h, pixmap->n, pixmap->alpha, 0, 0, 1); - fz_write_band(ctx, writer, pixmap->stride, 0, pixmap->h, pixmap->samples); - fz_write_trailer(ctx, writer); + fz_write_header(ctx, writer, pixmap->w, pixmap->h, pixmap->n, pixmap->alpha, 0, 0, 0); + fz_write_band(ctx, writer, pixmap->stride, pixmap->h, pixmap->samples); } fz_always(ctx) { @@ -222,9 +220,8 @@ void fz_write_pixmap_as_pam(fz_context *ctx, fz_output *out, fz_pixmap *pixmap) { fz_band_writer *writer = fz_new_pam_band_writer(ctx, out); - fz_write_header(ctx, writer, pixmap->w, pixmap->h, pixmap->n, pixmap->alpha, 0, 0, 1); - fz_write_band(ctx, writer, pixmap->stride, 0, pixmap->h, pixmap->samples); - fz_write_trailer(ctx, writer); + fz_write_header(ctx, writer, pixmap->w, pixmap->h, pixmap->n, pixmap->alpha, 0, 0, 0); + fz_write_band(ctx, writer, pixmap->stride, pixmap->h, pixmap->samples); fz_drop_band_writer(ctx, writer); } @@ -239,9 +236,8 @@ fz_save_pixmap_as_pam(fz_context *ctx, fz_pixmap *pixmap, char *filename) fz_try(ctx) { writer = fz_new_pam_band_writer(ctx, out); - fz_write_header(ctx, writer, pixmap->w, pixmap->h, pixmap->n, pixmap->alpha, 0, 0, 1); - fz_write_band(ctx, writer, pixmap->stride, 0, pixmap->h, pixmap->samples); - fz_write_trailer(ctx, writer); + fz_write_header(ctx, writer, pixmap->w, pixmap->h, pixmap->n, pixmap->alpha, 0, 0, 0); + fz_write_band(ctx, writer, pixmap->stride, pixmap->h, pixmap->samples); } fz_always(ctx) { -- cgit v1.2.3