libansilove

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

commit 8a9349ad65dabe1dec7ee7c345781ec3c6bc3b26
parent f5cbbf61dd44c6d9a25a9c632ae4cfd7817ec112
Author: Frederic Cambus <fred@statdns.com>
Date:   Wed, 26 Sep 2018 18:52:41 +0200

Modify the output function to take ansilove_options struct as parameter

Diffstat:
Msrc/loaders/ansi.c | 2+-
Msrc/loaders/artworx.c | 2+-
Msrc/loaders/binary.c | 2+-
Msrc/loaders/icedraw.c | 2+-
Msrc/loaders/pcboard.c | 2+-
Msrc/loaders/tundra.c | 2+-
Msrc/loaders/xbin.c | 2+-
Msrc/output.c | 8++++----
Msrc/output.h | 2+-
9 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/loaders/ansi.c b/src/loaders/ansi.c @@ -473,7 +473,7 @@ int ansilove_ansi(struct ansilove_ctx *ctx, struct ansilove_options *options) gdImageColorTransparent(canvas, 0); // create output image - output(ctx, canvas, options->retinaScaleFactor); + output(ctx, options, canvas); // free memory free(ansi_buffer); diff --git a/src/loaders/artworx.c b/src/loaders/artworx.c @@ -65,7 +65,7 @@ int ansilove_artworx(struct ansilove_ctx *ctx, struct ansilove_options *options) } // create output file - output(ctx, canvas, options->retinaScaleFactor); + output(ctx, options, canvas); return 0; } diff --git a/src/loaders/binary.c b/src/loaders/binary.c @@ -79,7 +79,7 @@ int ansilove_binary(struct ansilove_ctx *ctx, struct ansilove_options *options) } // create output image - output(ctx, canvas, options->retinaScaleFactor); + output(ctx, options, canvas); return 0; } diff --git a/src/loaders/icedraw.c b/src/loaders/icedraw.c @@ -115,7 +115,7 @@ int ansilove_icedraw(struct ansilove_ctx *ctx, struct ansilove_options *options) } // create output file - output(ctx, canvas, options->retinaScaleFactor); + output(ctx, options, canvas); // free memory free(idf_buffer); diff --git a/src/loaders/pcboard.c b/src/loaders/pcboard.c @@ -172,7 +172,7 @@ int ansilove_pcboard(struct ansilove_ctx *ctx, struct ansilove_options *options) } // create output image - output(ctx, canvas, options->retinaScaleFactor); + output(ctx, options, canvas); // free memory free(pcboard_buffer); diff --git a/src/loaders/tundra.c b/src/loaders/tundra.c @@ -163,7 +163,7 @@ int ansilove_tundra(struct ansilove_ctx *ctx, struct ansilove_options *options) } // create output image - output(ctx, canvas, options->retinaScaleFactor); + output(ctx, options, canvas); return 0; } diff --git a/src/loaders/xbin.c b/src/loaders/xbin.c @@ -168,7 +168,7 @@ int ansilove_xbin(struct ansilove_ctx *ctx, struct ansilove_options *options) } // create output file - output(ctx, canvas, options->retinaScaleFactor); + output(ctx, options, canvas); // nuke garbage free(font_data_xbin); diff --git a/src/output.c b/src/output.c @@ -12,18 +12,18 @@ #include "ansilove.h" #include "output.h" -int output(struct ansilove_ctx *ctx, gdImagePtr im_Source, int retinaScaleFactor) { +int output(struct ansilove_ctx *ctx, struct ansilove_options *options, gdImagePtr im_Source) { // XXX Error handling // XXX The caller must invoke gdFree() - if (!retinaScaleFactor) { + if (!options->retinaScaleFactor) { ctx->png.buffer = gdImagePngPtr(im_Source, &ctx->png.length); } else { gdImagePtr im_Retina; // make the Retina image retinaScaleFactor as large as im_Source - im_Retina = gdImageCreate(im_Source->sx * retinaScaleFactor, - im_Source->sy * retinaScaleFactor); + im_Retina = gdImageCreate(im_Source->sx * options->retinaScaleFactor, + im_Source->sy * options->retinaScaleFactor); gdImageCopyResized(im_Retina, im_Source, 0, 0, 0, 0, im_Retina->sx, im_Retina->sy, im_Source->sx, im_Source->sy); diff --git a/src/output.h b/src/output.h @@ -17,6 +17,6 @@ #define output_h // prototypes -int output(struct ansilove_ctx *, gdImagePtr, int); +int output(struct ansilove_ctx *, struct ansilove_options *, gdImagePtr); #endif