libansilove

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

commit bda7fd7d9640d69a6889818bd9ce978010a2ce60
parent f9f72b544bd327a5d5e9dd0194ffa599f41c08df
Author: Frederic Cambus <fred@statdns.com>
Date:   Fri, 29 Jun 2018 23:53:29 +0200

Simplify font data handling in the IceDraw loader

Diffstat:
Msrc/loaders/icedraw.c | 16+---------------
1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/src/loaders/icedraw.c b/src/loaders/icedraw.c @@ -13,9 +13,6 @@ void icedraw(struct input *inputFile, struct output *outputFile) { - const unsigned char *font_data; - unsigned char *font_data_idf; - // extract relevant part of the IDF header, 16-bit endian unsigned short int32_t x2 = (inputFile->data[9] << 8) + inputFile->data[8]; @@ -26,16 +23,6 @@ void icedraw(struct input *inputFile, struct output *outputFile) int32_t index; int32_t colors[16]; - // process IDF font - font_data_idf = (unsigned char *)malloc(4096); - if (font_data_idf == NULL) { - perror("Memory error"); - exit(7); - } - memcpy(font_data_idf, inputFile->data+(inputFile->size - 48 - 4096), 4096); - - font_data = font_data_idf; - // process IDF uint32_t idf_sequence_length, idf_sequence_loop, i = 0; @@ -130,7 +117,7 @@ void icedraw(struct input *inputFile, struct output *outputFile) background = (attribute & 240) >> 4; foreground = attribute & 15; - drawchar(canvas, font_data, 8, 16, column, row, colors[background], colors[foreground], character); + drawchar(canvas, inputFile->data+(inputFile->size - 48 - 4096), 8, 16, column, row, colors[background], colors[foreground], character); column++; } @@ -139,6 +126,5 @@ void icedraw(struct input *inputFile, struct output *outputFile) output(canvas, outputFile->fileName, outputFile->retina, outputFile->retinaScaleFactor); // free memory - free(font_data_idf); free(idf_buffer); }