Commits
Joshua Root authored 37a8ce0cd5c
1 + | --- writepng.c.orig 2009-06-13 06:58:50.000000000 +1000 |
2 + | +++ writepng.c 2012-10-20 22:16:09.000000000 +1100 |
3 + | @@ -240,6 +240,8 @@ void writepng(char *filename, |
4 + | double skewsin = sin(skew), skewcos = cos(skew); |
5 + | REAL minoverlay = 0, maxoverlay = 0; |
6 + | png_byte mask_byte; |
7 + | + png_colorp palette; |
8 + | + |
9 + | |
10 + | /* we must use direct color for translucent overlays */ |
11 + | if (overlay) |
12 + | @@ -309,7 +311,7 @@ void writepng(char *filename, |
13 + | } |
14 + | /* Set error handling. REQUIRED if you aren't supplying your own * |
15 + | * error hadnling functions in the png_create_write_struct() call. */ |
16 + | - if (setjmp(png_ptr->jmpbuf)) { |
17 + | + if (setjmp(png_jmpbuf(png_ptr))) { |
18 + | /* If we get here, we had a problem reading the file */ |
19 + | fclose(fp); |
20 + | png_destroy_write_struct(&png_ptr, (png_infopp) NULL); |
21 + | @@ -334,8 +336,6 @@ void writepng(char *filename, |
22 + | PNG_INTERLACE_NONE, |
23 + | PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); |
24 + | else { |
25 + | - png_colorp palette; |
26 + | - |
27 + | png_set_IHDR(png_ptr, info_ptr, width, height, 8 /* bit_depth */ , |
28 + | PNG_COLOR_TYPE_PALETTE, |
29 + | PNG_INTERLACE_NONE, |
30 + | @@ -434,7 +434,8 @@ void writepng(char *filename, |
31 + | png_write_end(png_ptr, info_ptr); |
32 + | |
33 + | /* if you malloced the palette, free it here */ |
34 + | - free(info_ptr->palette); |
35 + | + if (eight_bit) |
36 + | + png_free(palette); |
37 + | |
38 + | /* if you allocated any text comments, free them here */ |
39 + |