libansilove

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

commit 254d09375599455742b4e78e1be90c17fe6cd03c
parent 5f405411fd76f0df3ea61f64b294d3c72a253d67
Author: Frederic Cambus <fred@statdns.com>
Date:   Mon, 28 Sep 2020 21:31:12 +0200

Refactor canvas allocation for retina output.

Diffstat:
Msrc/output.c | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/output.c b/src/output.c @@ -37,15 +37,15 @@ output(struct ansilove_ctx *ctx, struct ansilove_options *options, /* Handle resizing */ if (options->scale_factor) { + uint32_t width, height; gdImagePtr retina; - if (gdImageTrueColor(source)) { - retina = gdImageCreateTrueColor(source->sx * - options->scale_factor, source->sy * options->scale_factor); - } else { - retina = gdImageCreate(source->sx * - options->scale_factor, source->sy * options->scale_factor); - } + width = source->sx * options->scale_factor; + height = source->sy * options->scale_factor; + + retina = gdImageTrueColor(source) ? + gdImageCreateTrueColor(width, height) : + gdImageCreate(width, height); if (!retina) { ctx->error = ANSILOVE_GD_ERROR;