Lines 58-64
Link Here
|
58 |
fclose(f); |
58 |
fclose(f); |
59 |
return 0; |
59 |
return 0; |
60 |
} |
60 |
} |
61 |
if (setjmp(png_ptr->jmpbuf)) |
61 |
if (setjmp(png_jmpbuf(png_ptr))) |
62 |
{ |
62 |
{ |
63 |
png_destroy_read_struct(&png_ptr, &info_ptr, NULL); |
63 |
png_destroy_read_struct(&png_ptr, &info_ptr, NULL); |
64 |
fclose(f); |
64 |
fclose(f); |
Lines 238-244
Link Here
|
238 |
png_structp png_ptr; |
238 |
png_structp png_ptr; |
239 |
png_infop info_ptr; |
239 |
png_infop info_ptr; |
240 |
DATA32 *ptr; |
240 |
DATA32 *ptr; |
241 |
int x, y, j; |
241 |
int x, y, j, interlace; |
242 |
png_bytep row_ptr, data = NULL; |
242 |
png_bytep row_ptr, data = NULL; |
243 |
png_color_8 sig_bit; |
243 |
png_color_8 sig_bit; |
244 |
int pl = 0; |
244 |
int pl = 0; |
Lines 265-271
Link Here
|
265 |
png_destroy_write_struct(&png_ptr, (png_infopp) NULL); |
265 |
png_destroy_write_struct(&png_ptr, (png_infopp) NULL); |
266 |
return 0; |
266 |
return 0; |
267 |
} |
267 |
} |
268 |
if (setjmp(png_ptr->jmpbuf)) |
268 |
if (setjmp(png_jmpbuf(png_ptr))) |
269 |
{ |
269 |
{ |
270 |
fclose(f); |
270 |
fclose(f); |
271 |
png_destroy_write_struct(&png_ptr, (png_infopp) & info_ptr); |
271 |
png_destroy_write_struct(&png_ptr, (png_infopp) & info_ptr); |
Lines 274-284
Link Here
|
274 |
} |
274 |
} |
275 |
|
275 |
|
276 |
/* check whether we should use interlacing */ |
276 |
/* check whether we should use interlacing */ |
|
|
277 |
interlace = PNG_INTERLACE_NONE; |
277 |
if ((tag = __imlib_GetTag(im, "interlacing")) && tag->val) |
278 |
if ((tag = __imlib_GetTag(im, "interlacing")) && tag->val) |
278 |
{ |
279 |
{ |
279 |
#ifdef PNG_WRITE_INTERLACING_SUPPORTED |
280 |
#ifdef PNG_WRITE_INTERLACING_SUPPORTED |
280 |
png_ptr->interlaced = PNG_INTERLACE_ADAM7; |
281 |
interlace = PNG_INTERLACE_ADAM7; |
281 |
num_passes = png_set_interlace_handling(png_ptr); |
|
|
282 |
#endif |
282 |
#endif |
283 |
} |
283 |
} |
284 |
|
284 |
|
Lines 286-292
Link Here
|
286 |
if (im->flags & F_HAS_ALPHA) |
286 |
if (im->flags & F_HAS_ALPHA) |
287 |
{ |
287 |
{ |
288 |
png_set_IHDR(png_ptr, info_ptr, im->w, im->h, 8, |
288 |
png_set_IHDR(png_ptr, info_ptr, im->w, im->h, 8, |
289 |
PNG_COLOR_TYPE_RGB_ALPHA, png_ptr->interlaced, |
289 |
PNG_COLOR_TYPE_RGB_ALPHA, interlace, |
290 |
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); |
290 |
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); |
291 |
#ifdef WORDS_BIGENDIAN |
291 |
#ifdef WORDS_BIGENDIAN |
292 |
png_set_swap_alpha(png_ptr); |
292 |
png_set_swap_alpha(png_ptr); |
Lines 297-303
Link Here
|
297 |
else |
297 |
else |
298 |
{ |
298 |
{ |
299 |
png_set_IHDR(png_ptr, info_ptr, im->w, im->h, 8, PNG_COLOR_TYPE_RGB, |
299 |
png_set_IHDR(png_ptr, info_ptr, im->w, im->h, 8, PNG_COLOR_TYPE_RGB, |
300 |
png_ptr->interlaced, PNG_COMPRESSION_TYPE_BASE, |
300 |
interlace, PNG_COMPRESSION_TYPE_BASE, |
301 |
PNG_FILTER_TYPE_BASE); |
301 |
PNG_FILTER_TYPE_BASE); |
302 |
data = malloc(im->w * 3 * sizeof(char)); |
302 |
data = malloc(im->w * 3 * sizeof(char)); |
303 |
} |
303 |
} |
Lines 344-349
Link Here
|
344 |
png_set_shift(png_ptr, &sig_bit); |
344 |
png_set_shift(png_ptr, &sig_bit); |
345 |
png_set_packing(png_ptr); |
345 |
png_set_packing(png_ptr); |
346 |
|
346 |
|
|
|
347 |
#ifdef PNG_WRITE_INTERLACING_SUPPORTED |
348 |
num_passes = png_set_interlace_handling(png_ptr); |
349 |
#endif |
350 |
|
347 |
for (pass = 0; pass < num_passes; pass++) |
351 |
for (pass = 0; pass < num_passes; pass++) |
348 |
{ |
352 |
{ |
349 |
ptr = im->data; |
353 |
ptr = im->data; |