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/tools/mudraw.c | 11 ++--------- source/tools/muraster.c | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) (limited to 'source/tools') diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c index 3b9911c5..74d7c3e2 100644 --- a/source/tools/mudraw.c +++ b/source/tools/mudraw.c @@ -757,7 +757,7 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in bander = fz_new_color_pcl_band_writer(ctx, out, NULL); } if (bander) - fz_write_header(ctx, bander, pix->w, totalheight, pix->n, pix->alpha, pix->xres, pix->yres, ++output_pagenum); + fz_write_header(ctx, bander, pix->w, totalheight, pix->n, pix->alpha, pix->xres, pix->yres, output_pagenum++); } for (band = 0; band < bands; band++) @@ -778,7 +778,7 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in if (output) { if (bander) - fz_write_band(ctx, bander, bit ? bit->stride : pix->stride, band * band_height, drawheight, bit ? bit->samples : pix->samples); + fz_write_band(ctx, bander, bit ? bit->stride : pix->stride, drawheight, bit ? bit->samples : pix->samples); else if (output_format == OUT_PWG) fz_write_pixmap_as_pwg(ctx, out, pix, NULL); else if (output_format == OUT_TGA) @@ -811,13 +811,6 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in for (i = 0; i < 16; i++) fprintf(stderr, "%02x", digest[i]); } - - /* Any page level trailers go here */ - if (output) - { - if (bander) - fz_write_trailer(ctx, bander); - } } fz_always(ctx) { diff --git a/source/tools/muraster.c b/source/tools/muraster.c index 22227bf2..468bb212 100644 --- a/source/tools/muraster.c +++ b/source/tools/muraster.c @@ -635,7 +635,7 @@ static int dodrawpage(fz_context *ctx, int pagenum, fz_cookie *cookie, render_de { /* If we get any errors while outputting the bands, retrying won't help. */ errors_are_fatal = 1; - fz_write_band(ctx, render->bander, bit ? bit->stride : pix->stride, band_start, draw_height, bit ? bit->samples : pix->samples); + fz_write_band(ctx, render->bander, bit ? bit->stride : pix->stride, draw_height, bit ? bit->samples : pix->samples); errors_are_fatal = 0; } fz_drop_bitmap(ctx, bit); -- cgit v1.2.3