diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-10-12 11:44:35 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-10-12 12:37:49 +0100 |
commit | 798aaf5adcc326ff96823be918452f01a29e0449 (patch) | |
tree | 363e0488fcf03652e736fabd06fc56154bf63108 /source | |
parent | 80308eae9964e71b66a18f3de6ebcd2ebf0d306b (diff) | |
download | mupdf-798aaf5adcc326ff96823be918452f01a29e0449.tar.xz |
Change code from using bandheight to using band_height.
Keep to our naming conventions.
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/bitmap.c | 4 | ||||
-rw-r--r-- | source/fitz/halftone.c | 2 | ||||
-rw-r--r-- | source/fitz/output-pcl.c | 14 | ||||
-rw-r--r-- | source/fitz/output-png.c | 10 | ||||
-rw-r--r-- | source/fitz/output-pnm.c | 8 | ||||
-rw-r--r-- | source/fitz/output-ps.c | 10 | ||||
-rw-r--r-- | source/tools/mudraw.c | 32 | ||||
-rw-r--r-- | source/tools/muraster.c | 2 |
8 files changed, 41 insertions, 41 deletions
diff --git a/source/fitz/bitmap.c b/source/fitz/bitmap.c index 46cfa533..f26cf935 100644 --- a/source/fitz/bitmap.c +++ b/source/fitz/bitmap.c @@ -346,7 +346,7 @@ fz_write_bitmap_as_pkm(fz_context *ctx, fz_output *out, fz_bitmap *bitmap) } static void -pbm_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_start, int bandheight, const unsigned char *p) +pbm_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_start, int band_height, const unsigned char *p) { fz_output *out = writer->out; int w = writer->w; @@ -366,7 +366,7 @@ pbm_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_sta } static void -pkm_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_start, int bandheight, const unsigned char *p) +pkm_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_start, int band_height, const unsigned char *p) { fz_output *out = writer->out; int w = writer->w; diff --git a/source/fitz/halftone.c b/source/fitz/halftone.c index 02353e76..0bc1dc98 100644 --- a/source/fitz/halftone.c +++ b/source/fitz/halftone.c @@ -509,7 +509,7 @@ static int gcd(int u, int v) while (1); } -fz_bitmap *fz_new_bitmap_from_pixmap_band(fz_context *ctx, fz_pixmap *pix, fz_halftone *ht, int band_start, int bandheight) +fz_bitmap *fz_new_bitmap_from_pixmap_band(fz_context *ctx, fz_pixmap *pix, fz_halftone *ht, int band_start, int band_height) { fz_bitmap *out = NULL; unsigned char *ht_line = NULL; diff --git a/source/fitz/output-pcl.c b/source/fitz/output-pcl.c index 96e7c973..4485453a 100644 --- a/source/fitz/output-pcl.c +++ b/source/fitz/output-pcl.c @@ -771,7 +771,7 @@ color_pcl_write_header(fz_context *ctx, fz_band_writer *writer_) } static void -color_pcl_write_band(fz_context *ctx, fz_band_writer *writer_, int stride, int band_start, int bandheight, const unsigned char *sp) +color_pcl_write_band(fz_context *ctx, fz_band_writer *writer_, int stride, int band_start, int band_height, const unsigned char *sp) { color_pcl_band_writer *writer = (color_pcl_band_writer *)writer_; fz_output *out = writer->super.out; @@ -791,18 +791,18 @@ color_pcl_write_band(fz_context *ctx, fz_band_writer *writer_, int stride, int b comp = writer->compbuf; seed_valid = writer->seed_valid; - if (band_start+bandheight >= h) - bandheight = h - band_start; + if (band_start+band_height >= h) + band_height = h - band_start; y = 0; - while (y < bandheight) + while (y < band_height) { /* Skip over multiple blank lines */ int blanks; do { blanks = 0; - while (blanks < 32767 && y < bandheight) + while (blanks < 32767 && y < band_height) { if (!line_is_blank(curr, sp, w)) break; @@ -826,7 +826,7 @@ color_pcl_write_band(fz_context *ctx, fz_band_writer *writer_, int stride, int b } while (blanks == 32767); - if (y == bandheight) + if (y == band_height) break; /* So, at least 1 more line to copy, and it's in curr */ @@ -1132,7 +1132,7 @@ mono_pcl_write_header(fz_context *ctx, fz_band_writer *writer_) } static void -mono_pcl_write_band(fz_context *ctx, fz_band_writer *writer_, int ss, int band_start, int bandheight, const unsigned char *data) +mono_pcl_write_band(fz_context *ctx, fz_band_writer *writer_, int ss, int band_start, int band_height, const unsigned char *data) { mono_pcl_band_writer *writer = (mono_pcl_band_writer *)writer_; fz_output *out = writer->super.out; diff --git a/source/fitz/output-png.c b/source/fitz/output-png.c index 620fa811..960e5292 100644 --- a/source/fitz/output-png.c +++ b/source/fitz/output-png.c @@ -125,7 +125,7 @@ png_write_header(fz_context *ctx, fz_band_writer *writer_) } static void -png_write_band(fz_context *ctx, fz_band_writer *writer_, int stride, int band_start, int bandheight, const unsigned char *sp) +png_write_band(fz_context *ctx, fz_band_writer *writer_, int stride, int band_start, int band_height, const unsigned char *sp) { png_band_writer *writer = (png_band_writer *)(void *)writer_; fz_output *out = writer->super.out; @@ -137,13 +137,13 @@ png_write_band(fz_context *ctx, fz_band_writer *writer_, int stride, int band_st h = writer->super.h; n = writer->super.n; - finalband = (band_start+bandheight >= h); + finalband = (band_start+band_height >= h); if (finalband) - bandheight = h - band_start; + band_height = h - band_start; if (writer->udata == NULL) { - writer->usize = (w * n + 1) * bandheight; + writer->usize = (w * n + 1) * band_height; /* Sadly the bound returned by compressBound is just for a * single usize chunk; if you compress a sequence of them * the buffering can result in you suddenly getting a block @@ -159,7 +159,7 @@ png_write_band(fz_context *ctx, fz_band_writer *writer_, int stride, int band_st dp = writer->udata; stride -= w*n; - for (y = 0; y < bandheight; y++) + for (y = 0; y < band_height; y++) { *dp++ = 1; /* sub prediction filter */ for (x = 0; x < w; x++) diff --git a/source/fitz/output-pnm.c b/source/fitz/output-pnm.c index b5796ab2..3a605524 100644 --- a/source/fitz/output-pnm.c +++ b/source/fitz/output-pnm.c @@ -25,7 +25,7 @@ pnm_write_header(fz_context *ctx, fz_band_writer *writer) } static void -pnm_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_start, int bandheight, const unsigned char *p) +pnm_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_start, int band_height, const unsigned char *p) { fz_output *out = writer->out; int w = writer->w; @@ -34,7 +34,7 @@ pnm_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_sta int alpha = writer->alpha; char buffer[2*3*4*5*6]; /* Buffer must be a multiple of 2 and 3 at least. */ int len; - int end = band_start + bandheight; + int end = band_start + band_height; if (n-alpha != 1 && n-alpha != 3) fz_throw(ctx, FZ_ERROR_GENERIC, "pixmap must be grayscale or rgb to write as pnm"); @@ -179,14 +179,14 @@ pam_write_header(fz_context *ctx, fz_band_writer *writer) } static void -pam_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_start, int bandheight, const unsigned char *sp) +pam_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_start, int band_height, const unsigned char *sp) { fz_output *out = writer->out; int w = writer->w; int h = writer->h; int n = writer->n; int y; - int end = band_start + bandheight; + int end = band_start + band_height; if (end > h) end = h; diff --git a/source/fitz/output-ps.c b/source/fitz/output-ps.c index 6e63110c..8b8d9bdb 100644 --- a/source/fitz/output-ps.c +++ b/source/fitz/output-ps.c @@ -175,7 +175,7 @@ void fz_save_pixmap_as_ps(fz_context *ctx, fz_pixmap *pixmap, char *filename, in } static void -ps_write_band(fz_context *ctx, fz_band_writer *writer_, int stride, int band_start, int bandheight, const unsigned char *samples) +ps_write_band(fz_context *ctx, fz_band_writer *writer_, int stride, int band_start, int band_height, const unsigned char *samples) { ps_band_writer *writer = (ps_band_writer *)writer_; fz_output *out = writer->super.out; @@ -187,10 +187,10 @@ ps_write_band(fz_context *ctx, fz_band_writer *writer_, int stride, int band_sta int required_output; unsigned char *o; - if (band_start+bandheight >= h) - bandheight = h - band_start; + if (band_start+band_height >= h) + band_height = h - band_start; - required_input = w*(n-1)*bandheight; + required_input = w*(n-1)*band_height; required_output = (int)deflateBound(&writer->stream, required_input); if (writer->input == NULL || writer->input_size < required_input) @@ -210,7 +210,7 @@ ps_write_band(fz_context *ctx, fz_band_writer *writer_, int stride, int band_sta } o = writer->input; - for (y = 0; y < bandheight; y++) + for (y = 0; y < band_height; y++) { for (x = 0; x < w; x++) { diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c index 4708516a..e5d18309 100644 --- a/source/tools/mudraw.c +++ b/source/tools/mudraw.c @@ -366,7 +366,7 @@ static int alphabits_graphics = 8; static int out_cs = CS_UNSET; static float gamma_value = 1; static int invert = 0; -static int bandheight = 0; +static int band_height = 0; static int lowmemory = 0; static int errored = 0; @@ -425,7 +425,7 @@ static void usage(void) "\t-w -\twidth (in pixels) (maximum width if -r is specified)\n" "\t-h -\theight (in pixels) (maximum height if -r is specified)\n" "\t-f -\tfit width and/or height exactly; ignore original aspect ratio\n" - "\t-B -\tmaximum bandheight (pgm, ppm, pam, png output only)\n" + "\t-B -\tmaximum band_height (pgm, ppm, pam, png output only)\n" #ifdef MUDRAW_THREADS "\t-T -\tnumber of threads to use for rendering (banded mode only)\n" #endif @@ -567,7 +567,7 @@ static void drawband(fz_context *ctx, fz_page *page, fz_display_list *list, cons fz_unmultiply_pixmap(ctx, pix); if ((output_format == OUT_PCL && out_cs == CS_MONO) || (output_format == OUT_PBM) || (output_format == OUT_PKM)) - *bit = fz_new_bitmap_from_pixmap_band(ctx, pix, NULL, band_start, bandheight); + *bit = fz_new_bitmap_from_pixmap_band(ctx, pix, NULL, band_start, band_height); } fz_catch(ctx) { @@ -833,15 +833,15 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in int totalheight = ibounds.y1 - ibounds.y0; int drawheight = totalheight; - if (bandheight != 0) + if (band_height != 0) { /* Banded rendering; we'll only render to a * given height at a time. */ - drawheight = bandheight; - if (totalheight > bandheight) - band_ibounds.y1 = band_ibounds.y0 + bandheight; - bands = (totalheight + bandheight-1)/bandheight; - tbounds.y1 = tbounds.y0 + bandheight + 2; + drawheight = band_height; + if (totalheight > band_height) + band_ibounds.y1 = band_ibounds.y0 + band_height; + bands = (totalheight + band_height-1)/band_height; + tbounds.y1 = tbounds.y0 + band_height + 2; DEBUG_THREADS(("Using %d Bands\n", bands)); } @@ -907,12 +907,12 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in cookie->errors += w->cookie.errors; } else - drawband(ctx, page, list, &ctm, &tbounds, cookie, band * bandheight, pix, &bit); + drawband(ctx, page, list, &ctm, &tbounds, cookie, band * band_height, pix, &bit); if (output) { if (bander) - fz_write_band(ctx, bander, bit ? bit->stride : pix->stride, band * bandheight, drawheight, bit ? bit->samples : pix->samples); + fz_write_band(ctx, bander, bit ? bit->stride : pix->stride, band * band_height, 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) @@ -1271,7 +1271,7 @@ static THREAD_RETURN_TYPE worker_thread(void *arg) SEMAPHORE_WAIT(me->start); DEBUG_THREADS(("Worker %d woken for band %d\n", me->num, me->band)); if (me->band >= 0) - drawband(me->ctx, NULL, me->list, &me->ctm, &me->tbounds, &me->cookie, me->band * bandheight, me->pix, &me->bit); + drawband(me->ctx, NULL, me->list, &me->ctm, &me->tbounds, &me->cookie, me->band * band_height, me->pix, &me->bit); DEBUG_THREADS(("Worker %d completed band %d\n", me->num, me->band)); SEMAPHORE_TRIGGER(me->stop); } @@ -1336,7 +1336,7 @@ int mudraw_main(int argc, char **argv) case 'w': width = fz_atof(fz_optarg); break; case 'h': height = fz_atof(fz_optarg); break; case 'f': fit = 1; break; - case 'B': bandheight = atoi(fz_optarg); break; + case 'B': band_height = atoi(fz_optarg); break; case 'c': out_cs = parse_colorspace(fz_optarg); break; case 'G': gamma_value = fz_atof(fz_optarg); break; @@ -1393,7 +1393,7 @@ int mudraw_main(int argc, char **argv) exit(1); } - if (bandheight == 0) + if (band_height == 0) { fprintf(stderr, "Using multiple threads without banding is pointless\n"); } @@ -1448,7 +1448,7 @@ int mudraw_main(int argc, char **argv) } /* Determine output type */ - if (bandheight < 0) + if (band_height < 0) { fprintf(stderr, "Bandheight must be > 0\n"); exit(1); @@ -1491,7 +1491,7 @@ int mudraw_main(int argc, char **argv) } } - if (bandheight) + if (band_height) { if (output_format != OUT_PAM && output_format != OUT_PGM && output_format != OUT_PPM && output_format != OUT_PNM && output_format != OUT_PNG && output_format != OUT_PBM && output_format != OUT_PKM && output_format != OUT_PCL && output_format != OUT_PS) { diff --git a/source/tools/muraster.c b/source/tools/muraster.c index a2fc7204..a85475e8 100644 --- a/source/tools/muraster.c +++ b/source/tools/muraster.c @@ -666,7 +666,7 @@ static void usage(void) "\t-w -\tprintable width (in inches) (default: " stringify(PAPER_WIDTH) ")\n" "\t-h -\tprintable height (in inches) (default: " stringify(PAPER_HEIGHT) "\n" "\t-f\tfit file to page if too large\n" - "\t-B -\tminimum bandheight (e.g. 32)\n" + "\t-B -\tminimum band height (e.g. 32)\n" "\t-M -\tmax bandmemory (e.g. 655360)\n" #if MURASTER_THREADS != 0 "\t-T -\tnumber of threads to use for rendering\n" |