1 |
vapier 11/02/21 01:05:56 |
2 |
|
3 |
Added: DirectFB-1.4.9-libpng-1.5.patch |
4 |
Log: |
5 |
Version bump. Fix building with libpng-1.5.x. |
6 |
|
7 |
(Portage version: 2.2.0_alpha24/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 dev-libs/DirectFB/files/DirectFB-1.4.9-libpng-1.5.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/DirectFB/files/DirectFB-1.4.9-libpng-1.5.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/DirectFB/files/DirectFB-1.4.9-libpng-1.5.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: DirectFB-1.4.9-libpng-1.5.patch |
16 |
=================================================================== |
17 |
From 83180b25e90721e717bf37c5332c22713508786e Mon Sep 17 00:00:00 2001 |
18 |
From: Mike Frysinger <vapier@g.o> |
19 |
Date: Sun, 20 Feb 2011 19:18:19 -0500 |
20 |
Subject: [PATCH] png: add support for libpng 1.5.x |
21 |
|
22 |
Signed-off-by: Mike Frysinger <vapier@g.o> |
23 |
--- |
24 |
.../idirectfbimageprovider_png.c | 56 ++++++++++++------- |
25 |
1 files changed, 35 insertions(+), 21 deletions(-) |
26 |
|
27 |
diff --git a/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c b/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c |
28 |
index 6d65ea3..7d82c5c 100644 |
29 |
--- a/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c |
30 |
+++ b/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c |
31 |
@@ -207,7 +207,7 @@ Construct( IDirectFBImageProvider *thiz, |
32 |
if (!data->png_ptr) |
33 |
goto error; |
34 |
|
35 |
- if (setjmp( data->png_ptr->jmpbuf )) { |
36 |
+ if (png_jmpbuf( data->png_ptr )) { |
37 |
D_ERROR( "ImageProvider/PNG: Error reading header!\n" ); |
38 |
goto error; |
39 |
} |
40 |
@@ -292,7 +292,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDirectFBImageProvider *thiz, |
41 |
rect = dst_data->area.wanted; |
42 |
} |
43 |
|
44 |
- if (setjmp( data->png_ptr->jmpbuf )) { |
45 |
+ if (png_jmpbuf( data->png_ptr )) { |
46 |
D_ERROR( "ImageProvider/PNG: Error during decoding!\n" ); |
47 |
|
48 |
if (data->stage < STAGE_IMAGE) |
49 |
@@ -327,6 +327,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDirectFBImageProvider *thiz, |
50 |
} |
51 |
else { |
52 |
CoreSurfaceBufferLock lock; |
53 |
+ png_byte bit_depth = png_get_bit_depth( data->png_ptr, data->info_ptr ); |
54 |
|
55 |
ret = dfb_surface_lock_buffer( dst_surface, CSBR_BACK, CSAID_CPU, CSAF_WRITE, &lock ); |
56 |
if (ret) |
57 |
@@ -334,7 +335,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDirectFBImageProvider *thiz, |
58 |
|
59 |
switch (data->color_type) { |
60 |
case PNG_COLOR_TYPE_PALETTE: |
61 |
- if (dst_surface->config.format == DSPF_LUT8 && data->info_ptr->bit_depth == 8) { |
62 |
+ if (dst_surface->config.format == DSPF_LUT8 && bit_depth == 8) { |
63 |
/* |
64 |
* Special indexed PNG to LUT8 loading. |
65 |
*/ |
66 |
@@ -377,7 +378,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDirectFBImageProvider *thiz, |
67 |
} |
68 |
else { |
69 |
if (data->color_type == PNG_COLOR_TYPE_GRAY) { |
70 |
- int num = 1 << data->info_ptr->bit_depth; |
71 |
+ int num = 1 << bit_depth; |
72 |
|
73 |
for (x=0; x<num; x++) { |
74 |
int value = x * 255 / (num - 1); |
75 |
@@ -386,7 +387,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDirectFBImageProvider *thiz, |
76 |
} |
77 |
} |
78 |
|
79 |
- switch (data->info_ptr->bit_depth) { |
80 |
+ switch (bit_depth) { |
81 |
case 8: |
82 |
for (y=0; y<data->height; y++) { |
83 |
u8 *S = data->image + data->pitch * y; |
84 |
@@ -441,7 +442,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDirectFBImageProvider *thiz, |
85 |
|
86 |
default: |
87 |
D_ERROR( "ImageProvider/PNG: Unsupported indexed bit depth %d!\n", |
88 |
- data->info_ptr->bit_depth ); |
89 |
+ bit_depth ); |
90 |
} |
91 |
|
92 |
dfb_scale_linear_32( image_argb, data->width, data->height, |
93 |
@@ -594,16 +595,26 @@ png_info_callback( png_structp png_read_ptr, |
94 |
NULL, NULL, NULL ); |
95 |
|
96 |
if (png_get_valid( data->png_ptr, data->info_ptr, PNG_INFO_tRNS )) { |
97 |
+ png_bytep trans; |
98 |
+ png_color_16p trans_color; |
99 |
+ int num_trans; |
100 |
+ |
101 |
+ png_get_tRNS( data->png_ptr, data->info_ptr, &trans, &num_trans, &trans_color ); |
102 |
+ |
103 |
data->color_keyed = true; |
104 |
|
105 |
/* generate color key based on palette... */ |
106 |
if (data->color_type == PNG_COLOR_TYPE_PALETTE) { |
107 |
u32 key; |
108 |
- png_colorp palette = data->info_ptr->palette; |
109 |
- png_bytep trans = data->info_ptr->trans_alpha; |
110 |
- int num_colors = MIN( MAXCOLORMAPSIZE, |
111 |
- data->info_ptr->num_palette ); |
112 |
- u8 cmap[3][num_colors]; |
113 |
+ png_colorp palette; |
114 |
+ int num_colors; |
115 |
+ u8 *cmap[3]; |
116 |
+ |
117 |
+ png_get_PLTE( data->png_ptr, data->info_ptr, &palette, &num_colors ); |
118 |
+ num_colors = MIN( MAXCOLORMAPSIZE, num_colors ); |
119 |
+ cmap[0] = alloca (num_colors); |
120 |
+ cmap[1] = alloca (num_colors); |
121 |
+ cmap[2] = alloca (num_colors); |
122 |
|
123 |
for (i=0; i<num_colors; i++) { |
124 |
cmap[0][i] = palette[i].red; |
125 |
@@ -613,7 +624,7 @@ png_info_callback( png_structp png_read_ptr, |
126 |
|
127 |
key = FindColorKey( num_colors, &cmap[0][0] ); |
128 |
|
129 |
- for (i=0; i<data->info_ptr->num_trans; i++) { |
130 |
+ for (i=0; i<num_trans; i++) { |
131 |
if (!trans[i]) { |
132 |
palette[i].red = (key & 0xff0000) >> 16; |
133 |
palette[i].green = (key & 0x00ff00) >> 8; |
134 |
@@ -625,20 +636,23 @@ png_info_callback( png_structp png_read_ptr, |
135 |
} |
136 |
else { |
137 |
/* ...or based on trans rgb value */ |
138 |
- png_color_16p trans = &data->info_ptr->trans_color; |
139 |
- |
140 |
- data->color_key = (((trans->red & 0xff00) << 8) | |
141 |
- ((trans->green & 0xff00)) | |
142 |
- ((trans->blue & 0xff00) >> 8)); |
143 |
+ data->color_key = (((trans_color->red & 0xff00) << 8) | |
144 |
+ ((trans_color->green & 0xff00)) | |
145 |
+ ((trans_color->blue & 0xff00) >> 8)); |
146 |
} |
147 |
} |
148 |
|
149 |
switch (data->color_type) { |
150 |
case PNG_COLOR_TYPE_PALETTE: { |
151 |
- png_colorp palette = data->info_ptr->palette; |
152 |
- png_bytep trans = data->info_ptr->trans_alpha; |
153 |
- int num_trans = data->info_ptr->num_trans; |
154 |
- int num_colors = MIN( MAXCOLORMAPSIZE, data->info_ptr->num_palette ); |
155 |
+ png_colorp palette; |
156 |
+ png_bytep trans; |
157 |
+ png_color_16p trans_color; |
158 |
+ int num_trans; |
159 |
+ int num_colors; |
160 |
+ |
161 |
+ png_get_PLTE( data->png_ptr, data->info_ptr, &palette, &num_colors ); |
162 |
+ num_colors = MIN( MAXCOLORMAPSIZE, num_colors ); |
163 |
+ png_get_tRNS( data->png_ptr, data->info_ptr, &trans, &num_trans, &trans_color ); |
164 |
|
165 |
for (i=0; i<num_colors; i++) { |
166 |
data->colors[i].a = (i < num_trans) ? trans[i] : 0xff; |
167 |
-- |
168 |
1.7.4.1 |
169 |
|
170 |
From 7a2a36fada3ecdd7f48fcfd782a552598477a8f5 Mon Sep 17 00:00:00 2001 |
171 |
From: Mike Frysinger <vapier@g.o> |
172 |
Date: Sun, 20 Feb 2011 19:38:50 -0500 |
173 |
Subject: [PATCH] tools: add support for libpng 1.5.x |
174 |
|
175 |
Signed-off-by: Mike Frysinger <vapier@g.o> |
176 |
--- |
177 |
tools/directfb-csource.c | 20 +++++++++++++------- |
178 |
tools/mkdfiff.c | 2 +- |
179 |
tools/mkdgifft.cpp | 2 +- |
180 |
3 files changed, 15 insertions(+), 9 deletions(-) |
181 |
|
182 |
diff --git a/tools/directfb-csource.c b/tools/directfb-csource.c |
183 |
index 8f2cbf0..487ea3c 100644 |
184 |
--- a/tools/directfb-csource.c |
185 |
+++ b/tools/directfb-csource.c |
186 |
@@ -338,7 +338,7 @@ static DFBResult load_image (const char *filename, |
187 |
if (!png_ptr) |
188 |
goto cleanup; |
189 |
|
190 |
- if (setjmp (png_ptr->jmpbuf)) { |
191 |
+ if (setjmp (png_jmpbuf (png_ptr))) { |
192 |
if (desc->preallocated[0].data) { |
193 |
free (desc->preallocated[0].data); |
194 |
desc->preallocated[0].data = NULL; |
195 |
@@ -405,17 +405,22 @@ static DFBResult load_image (const char *filename, |
196 |
} |
197 |
|
198 |
switch (src_format) { |
199 |
- case DSPF_LUT8: |
200 |
- if (info_ptr->num_palette) { |
201 |
+ case DSPF_LUT8: { |
202 |
+ png_colorp png_palette; |
203 |
+ int num_palette; |
204 |
+ |
205 |
+ png_get_PLTE( png_ptr, info_ptr, &png_palette, &num_palette ); |
206 |
+ |
207 |
+ if (num_palette) { |
208 |
png_byte *alpha; |
209 |
int i, num; |
210 |
|
211 |
- *palette_size = MIN (info_ptr->num_palette, 256); |
212 |
+ *palette_size = MIN (num_palette, 256); |
213 |
for (i = 0; i < *palette_size; i++) { |
214 |
palette[i].a = 0xFF; |
215 |
- palette[i].r = info_ptr->palette[i].red; |
216 |
- palette[i].g = info_ptr->palette[i].green; |
217 |
- palette[i].b = info_ptr->palette[i].blue; |
218 |
+ palette[i].r = png_palette[i].red; |
219 |
+ palette[i].g = png_palette[i].green; |
220 |
+ palette[i].b = png_palette[i].blue; |
221 |
} |
222 |
if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) { |
223 |
png_get_tRNS (png_ptr, info_ptr, &alpha, &num, NULL); |
224 |
@@ -424,6 +429,7 @@ static DFBResult load_image (const char *filename, |
225 |
} |
226 |
} |
227 |
break; |
228 |
+ } |
229 |
case DSPF_RGB32: |
230 |
png_set_filler (png_ptr, 0xFF, |
231 |
#ifdef WORDS_BIGENDIAN |
232 |
diff --git a/tools/mkdfiff.c b/tools/mkdfiff.c |
233 |
index 68a3b4f..edb58a7 100644 |
234 |
--- a/tools/mkdfiff.c |
235 |
+++ b/tools/mkdfiff.c |
236 |
@@ -97,7 +97,7 @@ load_image (const char *filename, |
237 |
if (!png_ptr) |
238 |
goto cleanup; |
239 |
|
240 |
- if (setjmp (png_ptr->jmpbuf)) { |
241 |
+ if (setjmp (png_jmpbuf (png_ptr))) { |
242 |
if (desc->preallocated[0].data) { |
243 |
free (desc->preallocated[0].data); |
244 |
desc->preallocated[0].data = NULL; |
245 |
diff --git a/tools/mkdgifft.cpp b/tools/mkdgifft.cpp |
246 |
index 96e4220..d4b6bf4 100644 |
247 |
--- a/tools/mkdgifft.cpp |
248 |
+++ b/tools/mkdgifft.cpp |
249 |
@@ -595,7 +595,7 @@ load_image (const char *filename, |
250 |
if (!png_ptr) |
251 |
goto cleanup; |
252 |
|
253 |
- if (setjmp (png_ptr->jmpbuf)) { |
254 |
+ if (setjmp (png_jmpbuf (png_ptr))) { |
255 |
if (desc->preallocated[0].data) { |
256 |
free (desc->preallocated[0].data); |
257 |
desc->preallocated[0].data = NULL; |
258 |
-- |
259 |
1.7.4.1 |