equal
deleted
inserted
replaced
182 else |
182 else |
183 log_info("\tImage dimensions: %zux%zu", img_info->width, img_info->height); |
183 log_info("\tImage dimensions: %zux%zu", img_info->width, img_info->height); |
184 |
184 |
185 // render tile? |
185 // render tile? |
186 if (ti.width && ti.height) { |
186 if (ti.width && ti.height) { |
187 log_debug("Async render tile %zux%zu@(%zu,%zu) -> stdout", ti.width, ti.height, ti.x, ti.y); |
187 char tmp_name[] = "pt-tile-XXXXXX"; |
188 |
188 int fd; |
189 if ((err = pt_image_tile_async(image, &ti, stdout))) |
189 FILE *out; |
|
190 |
|
191 // temporary file for output |
|
192 if ((fd = mkstemp(tmp_name)) < 0) { |
|
193 log_errno("mkstemp"); |
|
194 |
|
195 continue; |
|
196 } |
|
197 |
|
198 // open out |
|
199 if ((out = fdopen(fd, "w")) == NULL) { |
|
200 log_errno("fdopen"); |
|
201 |
|
202 continue; |
|
203 } |
|
204 |
|
205 // render |
|
206 log_debug("Async render tile %zux%zu@(%zu,%zu) -> %s", ti.width, ti.height, ti.x, ti.y, tmp_name); |
|
207 |
|
208 if ((err = pt_image_tile_async(image, &ti, out))) |
190 log_errno("pt_image_tile: %s: %s", img_path, pt_strerror(err)); |
209 log_errno("pt_image_tile: %s: %s", img_path, pt_strerror(err)); |
191 } |
210 } |
192 |
211 |
193 error: |
212 error: |
194 // cleanup |
213 // cleanup |