libansilove

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

commit 438b6f72400f3f992e4ab73fe21aab763b98ae53
parent 03e4f5ef7ec2deaae74c7f63b94fcaebf863f385
Author: Frederic Cambus <fred@statdns.com>
Date:   Mon,  2 Jul 2018 11:46:47 +0200

Move columns field to the output struct

Diffstat:
Minclude/ansilove.h | 2+-
Msrc/loaders/binary.c | 6+++---
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/ansilove.h b/include/ansilove.h @@ -20,7 +20,6 @@ struct input { unsigned char *data; size_t size; char *fext; - uint32_t columns; }; struct output { @@ -28,6 +27,7 @@ struct output { char *retina; char *font; uint32_t bits; + uint32_t columns; char *mode; bool icecolors; uint32_t retinaScaleFactor; diff --git a/src/loaders/binary.c b/src/loaders/binary.c @@ -29,8 +29,8 @@ int ansilove_binary(struct input *inputFile, struct output *outputFile) gdImagePtr canvas; // allocate buffer image memory - canvas = gdImageCreate(inputFile->columns * outputFile->bits, - ((inputFile->size / 2) / inputFile->columns * fontData.height)); + canvas = gdImageCreate(outputFile->columns * outputFile->bits, + ((inputFile->size / 2) / outputFile->columns * fontData.height)); if (!canvas) { perror("Error, can't allocate buffer image memory"); @@ -55,7 +55,7 @@ int ansilove_binary(struct input *inputFile, struct output *outputFile) while (loop < inputFile->size) { - if (column == inputFile->columns) + if (column == outputFile->columns) { column = 0; row++;