# HG changeset patch # User Tero Marttila # Date 1262271946 -7200 # Node ID 9fd50fc1d2239347dfb0088dd767851aedaf954f # Parent 811c88041c0623e25f34203f60098d8c3aaeff73 render async tile to separate tempfile diff -r 811c88041c06 -r 9fd50fc1d223 src/util/main.c --- a/src/util/main.c Thu Dec 31 17:01:38 2009 +0200 +++ b/src/util/main.c Thu Dec 31 17:05:46 2009 +0200 @@ -184,9 +184,28 @@ // render tile? if (ti.width && ti.height) { - log_debug("Async render tile %zux%zu@(%zu,%zu) -> stdout", ti.width, ti.height, ti.x, ti.y); + char tmp_name[] = "pt-tile-XXXXXX"; + int fd; + FILE *out; + + // temporary file for output + if ((fd = mkstemp(tmp_name)) < 0) { + log_errno("mkstemp"); + + continue; + } - if ((err = pt_image_tile_async(image, &ti, stdout))) + // open out + if ((out = fdopen(fd, "w")) == NULL) { + log_errno("fdopen"); + + continue; + } + + // render + log_debug("Async render tile %zux%zu@(%zu,%zu) -> %s", ti.width, ti.height, ti.x, ti.y, tmp_name); + + if ((err = pt_image_tile_async(image, &ti, out))) log_errno("pt_image_tile: %s: %s", img_path, pt_strerror(err)); }