libansilove

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

commit 6fb2dc441bcdf6577cecdc134ab4c929d0ce718a
parent 0e4700fe0ca84a64c603e5e43bb79790d7590144
Author: Frederic Cambus <fred@statdns.com>
Date:   Sat, 18 Jan 2020 23:01:17 +0100

Simplify things a bit regarding columns handling.

Diffstat:
Msrc/loaders/icedraw.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/loaders/icedraw.c b/src/loaders/icedraw.c @@ -36,7 +36,7 @@ ansilove_icedraw(struct ansilove_ctx *ctx, struct ansilove_options *options) } /* Get number of columns, 16-bit endian unsigned short */ - uint32_t x2 = (ctx->buffer[9] << 8) + ctx->buffer[8]; + uint32_t x2 = (ctx->buffer[9] << 8) + ctx->buffer[8] + 1; /* libgd image pointers */ gdImagePtr canvas; @@ -100,7 +100,7 @@ ansilove_icedraw(struct ansilove_ctx *ctx, struct ansilove_options *options) } /* create IDF instance */ - canvas = gdImageCreate((x2 + 1) * 8, i / 2 / 80 * 16); + canvas = gdImageCreate(x2 * 8, i / 2 / 80 * 16); /* error output */ if (!canvas) { @@ -124,7 +124,7 @@ ansilove_icedraw(struct ansilove_ctx *ctx, struct ansilove_options *options) uint32_t character, attribute, foreground, background; for (loop = 0; loop < i; loop += 2) { - if (column == x2 + 1) { + if (column == x2) { column = 0; row++; }