diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2015-02-21 16:19:40 +0100 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2015-05-02 21:36:45 +0200 |
commit | f300242e3cc5daf8a26fa673b4e812536132318a (patch) | |
tree | 91755c427546f005d8bf5576c18e15affe85cea6 | |
parent | 76c8b486bdce8b22b788dc268f9b72dae1843fcc (diff) | |
download | pucket-f300242e3cc5daf8a26fa673b4e812536132318a.tar.gz pucket-f300242e3cc5daf8a26fa673b4e812536132318a.tar.bz2 pucket-f300242e3cc5daf8a26fa673b4e812536132318a.zip |
Factor out genome printf
Fixes -random’s output.
-rw-r--r-- | main.c | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -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("<pick version=\"FLAM3-%s\">\n", flam3_version()); + flam3_print (stdout, genome, NULL, flam3_dont_print_edits); + printf("</pick>\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("<pick version=\"FLAM3-%s\">\n", flam3_version()); - flam3_print (stdout, genome, NULL, flam3_dont_print_edits); - printf("</pick>\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("<pick version=\"FLAM3-%s\">\n", flam3_version()); - flam3_print (stdout, &genome_out, NULL, flam3_dont_print_edits); - printf("</pick>\n"); - fflush(stdout); + print_genome (&genome_out); } #if 0 |