libansilove

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

commit 90a9ade33f6002dc792962b412f77db8994dfd69
parent dcdae2cc3ae7b53c12306adfce0a8fb704975711
Author: Frederic Cambus <fred@statdns.com>
Date:   Tue, 22 Sep 2020 23:05:31 +0200

Always update number of columns and lines used.

Previously, this was only done if a character was added to the buffer,
which meant trailing newlines were not rendered.

Diffstat:
Msrc/loaders/ansi.c | 14+++++++-------
Msrc/loaders/pcboard.c | 8++++----
2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/loaders/ansi.c b/src/loaders/ansi.c @@ -402,13 +402,6 @@ ansilove_ansi(struct ansilove_ctx *ctx, struct ansilove_options *options) } break; default: - /* record number of columns and lines used */ - if (column > columnMax) - columnMax = column; - - if (row > rowMax) - rowMax = row; - /* write current character in ansiChar structure */ if (!fontData.isAmigaFont || (current_character != 12 && current_character != 13)) { /* reallocate structure array memory */ @@ -445,6 +438,13 @@ ansilove_ansi(struct ansilove_ctx *ctx, struct ansilove_options *options) } } + /* record number of columns and lines used */ + if (column > columnMax) + columnMax = column; + + if (row > rowMax) + rowMax = row; + loop++; } diff --git a/src/loaders/pcboard.c b/src/loaders/pcboard.c @@ -119,10 +119,6 @@ ansilove_pcboard(struct ansilove_ctx *ctx, struct ansilove_options *options) } break; default: - /* record number of lines used */ - if (row > rowMax) - rowMax = row; - /* reallocate structure array memory */ ptr = realloc(pcboard_buffer, (structIndex + 1) * sizeof (struct pcbChar)); if (ptr == NULL) { @@ -144,6 +140,10 @@ ansilove_pcboard(struct ansilove_ctx *ctx, struct ansilove_options *options) structIndex++; } + /* record number of lines used */ + if (row > rowMax) + rowMax = row; + loop++; } rowMax++;