libansilove

Library for converting ANSI, ASCII, and other formats to PNG
Log | Files | Refs | README | LICENSE

commit 5e4f236b0ac0a890eb8a1c98e8c7f179a20e59c6
parent 40ecff56b1af844cf0a9a1893afe3ed1354d2784
Author: Frederic Cambus <fred@statdns.com>
Date:   Wed, 12 Dec 2018 18:18:07 +0100

Wrap lines longer than 80 columns

Diffstat:
Msrc/drawchar.c | 9++++++---
Msrc/loaders/icedraw.c | 9++++++---
Msrc/loaders/pcboard.c | 6++++--
Msrc/loaders/xbin.c | 18++++++++++++------
Msrc/output.c | 3++-
5 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/src/drawchar.c b/src/drawchar.c @@ -29,10 +29,13 @@ drawchar(gdImagePtr im, const uint8_t *font_data, uint32_t bits, for (x = 0; x < bits; x++) { if ((font_data[y+character*height] & (0x80 >> x)) != 0) { - gdImageSetPixel(im, column * bits + x, row*height + y, foreground); + gdImageSetPixel(im, column * bits + x, + row*height + y, foreground); - if (bits == 9 && x == 7 && character > 191 && character < 224) - gdImageSetPixel(im, column * bits + 8, row * height + y, foreground); + if (bits == 9 && x == 7 && + character > 191 && character < 224) + gdImageSetPixel(im, column * bits + 8, + row * height + y, foreground); } } } diff --git a/src/loaders/icedraw.c b/src/loaders/icedraw.c @@ -35,7 +35,7 @@ ansilove_icedraw(struct ansilove_ctx *ctx, struct ansilove_options *options) return -1; } - /* extract relevant part of the IDF header, 16-bit endian unsigned short */ + /* Get number of columns, 16-bit endian unsigned short */ uint32_t x2 = (ctx->buffer[9] << 8) + ctx->buffer[8]; /* libgd image pointers */ @@ -111,7 +111,8 @@ ansilove_icedraw(struct ansilove_ctx *ctx, struct ansilove_options *options) /* process IDF palette */ for (loop = 0; loop < 16; loop++) { index = (loop * 3) + ctx->length - 48; - colors[loop] = gdImageColorAllocate(canvas, (ctx->buffer[index] << 2 | ctx->buffer[index] >> 4), + colors[loop] = gdImageColorAllocate(canvas, + (ctx->buffer[index] << 2 | ctx->buffer[index] >> 4), (ctx->buffer[index + 1] << 2 | ctx->buffer[index + 1] >> 4), (ctx->buffer[index + 2] << 2 | ctx->buffer[index + 2] >> 4)); } @@ -132,7 +133,9 @@ ansilove_icedraw(struct ansilove_ctx *ctx, struct ansilove_options *options) background = (attribute & 240) >> 4; foreground = attribute & 15; - drawchar(canvas, ctx->buffer+(ctx->length - IDF_HEADER_LENGTH), 8, 16, column, row, colors[background], colors[foreground], character); + drawchar(canvas, ctx->buffer+(ctx->length - IDF_HEADER_LENGTH), + 8, 16, column, row, + colors[background], colors[foreground], character); column++; } diff --git a/src/loaders/pcboard.c b/src/loaders/pcboard.c @@ -97,7 +97,8 @@ ansilove_pcboard(struct ansilove_ctx *ctx, struct ansilove_options *options) loop += 3; } - if (next_character == 67 && ctx->buffer[loop+2] == 'L' && ctx->buffer[loop+3] == 'S') { + if (next_character == 67 && ctx->buffer[loop+2] == 'L' + && ctx->buffer[loop+3] == 'S') { /* erase display */ column = 0; row = 0; @@ -108,7 +109,8 @@ ansilove_pcboard(struct ansilove_ctx *ctx, struct ansilove_options *options) loop += 4; } - if (next_character == 80 && ctx->buffer[loop+2] == 'O' && ctx->buffer[loop+3] == 'S' && ctx->buffer[loop+4] == ':') { + if (next_character == 80 && ctx->buffer[loop+2] == 'O' + && ctx->buffer[loop+3] == 'S' && ctx->buffer[loop+4] == ':') { /* cursor position */ if (ctx->buffer[loop+6] == '@') { diff --git a/src/loaders/xbin.c b/src/loaders/xbin.c @@ -73,7 +73,8 @@ ansilove_xbin(struct ansilove_ctx *ctx, struct ansilove_options *options) for (loop = 0; loop < 16; loop++) { index = (loop * 3) + offset; - colors[loop] = gdImageColorAllocate(canvas, (ctx->buffer[index] << 2 | ctx->buffer[index] >> 4), + colors[loop] = gdImageColorAllocate(canvas, + (ctx->buffer[index] << 2 | ctx->buffer[index] >> 4), (ctx->buffer[index + 1] << 2 | ctx->buffer[index + 1] >> 4), (ctx->buffer[index + 2] << 2 | ctx->buffer[index + 2] >> 4)); } @@ -81,8 +82,8 @@ ansilove_xbin(struct ansilove_ctx *ctx, struct ansilove_options *options) offset += 48; } else { for (int i = 0; i < 16; i++) { - colors[i] = gdImageColorAllocate(canvas, binary_palette[i*3], - binary_palette[i*3+1], + colors[i] = gdImageColorAllocate(canvas, + binary_palette[i*3], binary_palette[i*3+1], binary_palette[i*3+2]); } } @@ -97,7 +98,8 @@ ansilove_xbin(struct ansilove_ctx *ctx, struct ansilove_options *options) ctx->error = ANSILOVE_MEMORY_ERROR; return -1; } - memcpy(font_data_xbin, ctx->buffer+offset, (xbin_fontsize * numchars)); + memcpy(font_data_xbin, ctx->buffer+offset, + (xbin_fontsize * numchars)); font_data = font_data_xbin; @@ -160,7 +162,9 @@ ansilove_xbin(struct ansilove_ctx *ctx, struct ansilove_options *options) background = (attribute & 240) >> 4; foreground = attribute & 15; - drawchar(canvas, font_data, 8, 16, column, row, colors[background], colors[foreground], character); + drawchar(canvas, font_data, 8, 16, column, row, + colors[background], colors[foreground], + character); column++; @@ -184,7 +188,9 @@ ansilove_xbin(struct ansilove_ctx *ctx, struct ansilove_options *options) background = (attribute & 240) >> 4; foreground = attribute & 15; - drawchar(canvas, font_data, 8, xbin_fontsize, column, row, colors[background], colors[foreground], character); + drawchar(canvas, font_data, 8, xbin_fontsize, + column, row, colors[background], + colors[foreground], character); column++; offset += 2; diff --git a/src/output.c b/src/output.c @@ -15,7 +15,8 @@ #include "output.h" int -output(struct ansilove_ctx *ctx, struct ansilove_options *options, gdImagePtr im_Source) +output(struct ansilove_ctx *ctx, struct ansilove_options *options, + gdImagePtr im_Source) { /* XXX Error handling */ /* XXX The caller must invoke gdFree() */