libansilove

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

commit 561ada24f3fafe77b2a45bb3232ed8b330bc6251
parent 1c60f709021fd5b9364d47e0f11c3720620a54b5
Author: Frederic Cambus <fred@statdns.com>
Date:   Sat, 18 Jan 2020 23:17:07 +0100

Use IDF_HEADER_LENGTH and IDF_PALETTE_LENGTH instead of magic values.

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

diff --git a/src/loaders/icedraw.c b/src/loaders/icedraw.c @@ -43,7 +43,7 @@ ansilove_icedraw(struct ansilove_ctx *ctx, struct ansilove_options *options) /* libgd image pointers */ gdImagePtr canvas; - uint32_t loop = 12; + uint32_t loop = IDF_HEADER_LENGTH; uint32_t index; uint32_t colors[16]; @@ -108,7 +108,7 @@ 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; + index = (loop * 3) + ctx->length - IDF_PALETTE_LENGTH; colors[loop] = gdImageColorAllocate(canvas, (ctx->buffer[index] << 2 | ctx->buffer[index] >> 4), (ctx->buffer[index + 1] << 2 | ctx->buffer[index + 1] >> 4),