1 |
pva 11/05/01 10:11:26 |
2 |
|
3 |
Added: xfig-3.2.5b-libpng-1.5.patch |
4 |
Log: |
5 |
Fix build issue with libpng-1.5, bug #356753 thank Alexis Ballier for this patch. Drop old. |
6 |
|
7 |
(Portage version: 2.1.9.46/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 media-gfx/xfig/files/xfig-3.2.5b-libpng-1.5.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-gfx/xfig/files/xfig-3.2.5b-libpng-1.5.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-gfx/xfig/files/xfig-3.2.5b-libpng-1.5.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: xfig-3.2.5b-libpng-1.5.patch |
16 |
=================================================================== |
17 |
Index: xfig.3.2.5b/f_readpng.c |
18 |
=================================================================== |
19 |
--- xfig.3.2.5b.orig/f_readpng.c |
20 |
+++ xfig.3.2.5b/f_readpng.c |
21 |
@@ -73,7 +73,7 @@ read_png(FILE *file, int filetype, F_pic |
22 |
} |
23 |
|
24 |
/* set long jump recovery here */ |
25 |
- if (setjmp(png_ptr->jmpbuf)) { |
26 |
+ if (setjmp(png_jmpbuf(png_ptr))) { |
27 |
/* if we get here there was a problem reading the file */ |
28 |
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); |
29 |
close_picfile(file,filetype); |
30 |
@@ -90,15 +90,17 @@ read_png(FILE *file, int filetype, F_pic |
31 |
png_get_IHDR(png_ptr, info_ptr, &w, &h, &bit_depth, &color_type, |
32 |
&interlace_type, &compression_type, &filter_type); |
33 |
|
34 |
- if (info_ptr->valid & PNG_INFO_gAMA) |
35 |
- png_set_gamma(png_ptr, 2.2, info_ptr->gamma); |
36 |
- else |
37 |
- png_set_gamma(png_ptr, 2.2, 0.45); |
38 |
+ png_fixed_point gamma = 0.45; |
39 |
+ png_get_gAMA_fixed(png_ptr,info_ptr,&gamma); |
40 |
+ png_set_gamma(png_ptr, 2.2, gamma); |
41 |
|
42 |
- if (info_ptr->valid & PNG_INFO_bKGD) |
43 |
+ if (png_get_valid(png_ptr,info_ptr,PNG_INFO_bKGD)) { |
44 |
/* set the background to the one supplied */ |
45 |
- png_set_background(png_ptr, &info_ptr->background, |
46 |
+ png_color_16p background; |
47 |
+ png_get_bKGD(png_ptr,info_ptr,&background); |
48 |
+ png_set_background(png_ptr, background, |
49 |
PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); |
50 |
+ } |
51 |
else { |
52 |
/* blend the canvas background using the alpha channel */ |
53 |
background.red = x_bg_color.red >> 8; |
54 |
@@ -136,7 +138,11 @@ read_png(FILE *file, int filetype, F_pic |
55 |
|
56 |
if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette)) { |
57 |
png_get_hIST(png_ptr, info_ptr, &histogram); |
58 |
+#if PNG_LIBPNG_VER_MAJOR <= 1 && PNG_LIBPNG_VER_MINOR < 5 |
59 |
png_set_dither(png_ptr, palette, num_palette, 256, histogram, 0); |
60 |
+#else |
61 |
+ png_set_quantize(png_ptr, palette, num_palette, 256, histogram, 0); |
62 |
+#endif |
63 |
} |
64 |
} |
65 |
if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { |
66 |
Index: xfig.3.2.5b/f_wrpng.c |
67 |
=================================================================== |
68 |
--- xfig.3.2.5b.orig/f_wrpng.c |
69 |
+++ xfig.3.2.5b/f_wrpng.c |
70 |
@@ -20,6 +20,7 @@ |
71 |
#include "w_msgpanel.h" |
72 |
#include "w_setup.h" |
73 |
#include <png.h> |
74 |
+#include <zlib.h> |
75 |
|
76 |
/* |
77 |
* Write PNG file from rgb data |
78 |
@@ -59,7 +60,7 @@ write_png(FILE *file, unsigned char *dat |
79 |
} |
80 |
|
81 |
/* set long jump recovery here */ |
82 |
- if (setjmp(png_ptr->jmpbuf)) { |
83 |
+ if (setjmp(png_jmpbuf(png_ptr))) { |
84 |
/* if we get here there was a problem reading the file */ |
85 |
png_destroy_write_struct(&png_ptr, &info_ptr); |
86 |
return False; |