From: Francois Fleuret Date: Tue, 28 Feb 2017 21:06:56 +0000 (+0100) Subject: Update. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=flatland.git;a=commitdiff_plain;h=546ec5453243e2efbf8c3caefdc04394ca87676d Update. --- diff --git a/flatland.cc b/flatland.cc index 92a5ebb..e41e565 100644 --- a/flatland.cc +++ b/flatland.cc @@ -228,16 +228,27 @@ extern "C" void fl_generate_sequences(int nb_sequences, } for(int t = 0; t < nb_images_per_sequence; t++) { - memcpy(output + (n * nb_images_per_sequence + t) * 3 * width * height, - canvases[t]->_data, - 3 * width * height); + unsigned char *src = canvases[t]->_data; + unsigned char *dst = output + (n * nb_images_per_sequence + t) * width * height * 3; + for(int d = 0; d < 3; d++) { + for(int y = 0; y < height; y++) { + for(int x = 0; x < width; x++) { + dst[x + width * (y + height * d)] = src[d + 4 * (x + width * y)]; + } + } + } } - // char buffer[1024]; - // sprintf(buffer, "%s/%03d/dyn_%06d.png", data_dir, n / 1000, n); - // FILE *file = safe_fopen(buffer, "w"); - // main_canvas.write_png(file); - // fclose(file); + /* + { + cout << canvases[0]->_actual_width << " "<< canvases[1]->_actual_height << endl; + cout << "Writing /tmp/sanity.png" << endl; + CanvasCairo main_canvas(scaling, nb_images_per_sequence, 1, canvases); + FILE *file = safe_fopen("/tmp/sanity.png", "w"); + main_canvas.write_png(file); + fclose(file); + } + */ } for(int t = 0; t < 2 * nb_saved_frames; t++) {