From f300242e3cc5daf8a26fa673b4e812536132318a Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sat, 21 Feb 2015 16:19:40 +0100 Subject: Factor out genome printf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes -random’s output. --- main.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 3549e07..bfc0c7c 100644 --- a/main.c +++ b/main.c @@ -156,6 +156,12 @@ static void do_render (const render_arguments * const arguments) { f.bytes_per_channel); } +static void print_genome (flam3_genome * const genome) { + printf("\n", flam3_version()); + flam3_print (stdout, genome, NULL, flam3_dont_print_edits); + printf("\n"); +} + typedef struct { int symmetry; const char *palette; @@ -250,8 +256,7 @@ static void do_random (const random_arguments * const arguments) { adjust_bounding_box (&genome, &rc); - flam3_print (stdout, &genome, NULL, flam3_dont_print_edits); - fflush(stdout); + print_genome (&genome); } typedef struct { @@ -323,10 +328,7 @@ static void do_mutate (const mutate_arguments * const arguments) { flam3_mutate (genome, arguments->method, &ivars, 1, arguments->symmetry, speed, &rc); - printf("\n", flam3_version()); - flam3_print (stdout, genome, NULL, flam3_dont_print_edits); - printf("\n"); - fflush(stdout); + print_genome (genome); } typedef struct { @@ -387,10 +389,7 @@ static void do_cross (const cross_arguments * const arguments) { flam3_cross (genome_a, genome_b, &genome_out, arguments->method, &rc); - printf("\n", flam3_version()); - flam3_print (stdout, &genome_out, NULL, flam3_dont_print_edits); - printf("\n"); - fflush(stdout); + print_genome (&genome_out); } #if 0 -- cgit v1.2.3