wok-next rev 20213
directfb: add libpng patch
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Nov 04 22:29:34 2017 +0100 (2017-11-04) |
parents | 650b75e18a32 |
children | 831b04c8239e |
files | directfb/stuff/patches/DirectFB-1.4.9-libpng-1.5.patch directfb/stuff/patches/series eboard/receipt |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/directfb/stuff/patches/DirectFB-1.4.9-libpng-1.5.patch Sat Nov 04 22:29:34 2017 +0100 1.3 @@ -0,0 +1,244 @@ 1.4 +From 83180b25e90721e717bf37c5332c22713508786e Mon Sep 17 00:00:00 2001 1.5 +From: Mike Frysinger <vapier@gentoo.org> 1.6 +Date: Sun, 20 Feb 2011 19:18:19 -0500 1.7 +Subject: [PATCH] png: add support for libpng 1.5.x 1.8 + 1.9 +Signed-off-by: Mike Frysinger <vapier@gentoo.org> 1.10 +--- 1.11 + .../idirectfbimageprovider_png.c | 56 ++++++++++++------- 1.12 + 1 files changed, 35 insertions(+), 21 deletions(-) 1.13 + 1.14 +diff --git a/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c b/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c 1.15 +index 6d65ea3..7d82c5c 100644 1.16 +--- a/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c 1.17 ++++ b/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c 1.18 +@@ -207,7 +207,7 @@ Construct( IDirectFBImageProvider *thiz, 1.19 + if (!data->png_ptr) 1.20 + goto error; 1.21 + 1.22 +- if (setjmp( data->png_ptr->jmpbuf )) { 1.23 ++ if (setjmp( png_jmpbuf( data->png_ptr ))) { 1.24 + D_ERROR( "ImageProvider/PNG: Error reading header!\n" ); 1.25 + goto error; 1.26 + } 1.27 +@@ -292,7 +292,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDirectFBImageProvider *thiz, 1.28 + rect = dst_data->area.wanted; 1.29 + } 1.30 + 1.31 +- if (setjmp( data->png_ptr->jmpbuf )) { 1.32 ++ if (setjmp( png_jmpbuf( data->png_ptr ))) { 1.33 + D_ERROR( "ImageProvider/PNG: Error during decoding!\n" ); 1.34 + 1.35 + if (data->stage < STAGE_IMAGE) 1.36 +@@ -327,6 +327,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDirectFBImageProvider *thiz, 1.37 + } 1.38 + else { 1.39 + CoreSurfaceBufferLock lock; 1.40 ++ png_byte bit_depth = png_get_bit_depth( data->png_ptr, data->info_ptr ); 1.41 + 1.42 + ret = dfb_surface_lock_buffer( dst_surface, CSBR_BACK, CSAID_CPU, CSAF_WRITE, &lock ); 1.43 + if (ret) 1.44 +@@ -334,7 +335,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDirectFBImageProvider *thiz, 1.45 + 1.46 + switch (data->color_type) { 1.47 + case PNG_COLOR_TYPE_PALETTE: 1.48 +- if (dst_surface->config.format == DSPF_LUT8 && data->info_ptr->bit_depth == 8) { 1.49 ++ if (dst_surface->config.format == DSPF_LUT8 && bit_depth == 8) { 1.50 + /* 1.51 + * Special indexed PNG to LUT8 loading. 1.52 + */ 1.53 +@@ -377,7 +378,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDirectFBImageProvider *thiz, 1.54 + } 1.55 + else { 1.56 + if (data->color_type == PNG_COLOR_TYPE_GRAY) { 1.57 +- int num = 1 << data->info_ptr->bit_depth; 1.58 ++ int num = 1 << bit_depth; 1.59 + 1.60 + for (x=0; x<num; x++) { 1.61 + int value = x * 255 / (num - 1); 1.62 +@@ -386,7 +387,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDirectFBImageProvider *thiz, 1.63 + } 1.64 + } 1.65 + 1.66 +- switch (data->info_ptr->bit_depth) { 1.67 ++ switch (bit_depth) { 1.68 + case 8: 1.69 + for (y=0; y<data->height; y++) { 1.70 + u8 *S = data->image + data->pitch * y; 1.71 +@@ -441,7 +442,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDirectFBImageProvider *thiz, 1.72 + 1.73 + default: 1.74 + D_ERROR( "ImageProvider/PNG: Unsupported indexed bit depth %d!\n", 1.75 +- data->info_ptr->bit_depth ); 1.76 ++ bit_depth ); 1.77 + } 1.78 + 1.79 + dfb_scale_linear_32( image_argb, data->width, data->height, 1.80 +@@ -594,16 +595,26 @@ png_info_callback( png_structp png_read_ptr, 1.81 + NULL, NULL, NULL ); 1.82 + 1.83 + if (png_get_valid( data->png_ptr, data->info_ptr, PNG_INFO_tRNS )) { 1.84 ++ png_bytep trans; 1.85 ++ png_color_16p trans_color; 1.86 ++ int num_trans; 1.87 ++ 1.88 ++ png_get_tRNS( data->png_ptr, data->info_ptr, &trans, &num_trans, &trans_color ); 1.89 ++ 1.90 + data->color_keyed = true; 1.91 + 1.92 + /* generate color key based on palette... */ 1.93 + if (data->color_type == PNG_COLOR_TYPE_PALETTE) { 1.94 + u32 key; 1.95 +- png_colorp palette = data->info_ptr->palette; 1.96 +- png_bytep trans = data->info_ptr->trans_alpha; 1.97 +- int num_colors = MIN( MAXCOLORMAPSIZE, 1.98 +- data->info_ptr->num_palette ); 1.99 +- u8 cmap[3][num_colors]; 1.100 ++ png_colorp palette; 1.101 ++ int num_colors; 1.102 ++ u8 *cmap[3]; 1.103 ++ 1.104 ++ png_get_PLTE( data->png_ptr, data->info_ptr, &palette, &num_colors ); 1.105 ++ num_colors = MIN( MAXCOLORMAPSIZE, num_colors ); 1.106 ++ cmap[0] = alloca (num_colors); 1.107 ++ cmap[1] = alloca (num_colors); 1.108 ++ cmap[2] = alloca (num_colors); 1.109 + 1.110 + for (i=0; i<num_colors; i++) { 1.111 + cmap[0][i] = palette[i].red; 1.112 +@@ -613,7 +624,7 @@ png_info_callback( png_structp png_read_ptr, 1.113 + 1.114 + key = FindColorKey( num_colors, &cmap[0][0] ); 1.115 + 1.116 +- for (i=0; i<data->info_ptr->num_trans; i++) { 1.117 ++ for (i=0; i<num_trans; i++) { 1.118 + if (!trans[i]) { 1.119 + palette[i].red = (key & 0xff0000) >> 16; 1.120 + palette[i].green = (key & 0x00ff00) >> 8; 1.121 +@@ -625,20 +636,23 @@ png_info_callback( png_structp png_read_ptr, 1.122 + } 1.123 + else { 1.124 + /* ...or based on trans rgb value */ 1.125 +- png_color_16p trans = &data->info_ptr->trans_color; 1.126 +- 1.127 +- data->color_key = (((trans->red & 0xff00) << 8) | 1.128 +- ((trans->green & 0xff00)) | 1.129 +- ((trans->blue & 0xff00) >> 8)); 1.130 ++ data->color_key = (((trans_color->red & 0xff00) << 8) | 1.131 ++ ((trans_color->green & 0xff00)) | 1.132 ++ ((trans_color->blue & 0xff00) >> 8)); 1.133 + } 1.134 + } 1.135 + 1.136 + switch (data->color_type) { 1.137 + case PNG_COLOR_TYPE_PALETTE: { 1.138 +- png_colorp palette = data->info_ptr->palette; 1.139 +- png_bytep trans = data->info_ptr->trans_alpha; 1.140 +- int num_trans = data->info_ptr->num_trans; 1.141 +- int num_colors = MIN( MAXCOLORMAPSIZE, data->info_ptr->num_palette ); 1.142 ++ png_colorp palette; 1.143 ++ png_bytep trans; 1.144 ++ png_color_16p trans_color; 1.145 ++ int num_trans; 1.146 ++ int num_colors; 1.147 ++ 1.148 ++ png_get_PLTE( data->png_ptr, data->info_ptr, &palette, &num_colors ); 1.149 ++ num_colors = MIN( MAXCOLORMAPSIZE, num_colors ); 1.150 ++ png_get_tRNS( data->png_ptr, data->info_ptr, &trans, &num_trans, &trans_color ); 1.151 + 1.152 + for (i=0; i<num_colors; i++) { 1.153 + data->colors[i].a = (i < num_trans) ? trans[i] : 0xff; 1.154 +-- 1.155 +1.7.4.1 1.156 + 1.157 +From 7a2a36fada3ecdd7f48fcfd782a552598477a8f5 Mon Sep 17 00:00:00 2001 1.158 +From: Mike Frysinger <vapier@gentoo.org> 1.159 +Date: Sun, 20 Feb 2011 19:38:50 -0500 1.160 +Subject: [PATCH] tools: add support for libpng 1.5.x 1.161 + 1.162 +Signed-off-by: Mike Frysinger <vapier@gentoo.org> 1.163 +--- 1.164 + tools/directfb-csource.c | 20 +++++++++++++------- 1.165 + tools/mkdfiff.c | 2 +- 1.166 + tools/mkdgifft.cpp | 2 +- 1.167 + 3 files changed, 15 insertions(+), 9 deletions(-) 1.168 + 1.169 +diff --git a/tools/directfb-csource.c b/tools/directfb-csource.c 1.170 +index 8f2cbf0..487ea3c 100644 1.171 +--- a/tools/directfb-csource.c 1.172 ++++ b/tools/directfb-csource.c 1.173 +@@ -338,7 +338,7 @@ static DFBResult load_image (const char *filename, 1.174 + if (!png_ptr) 1.175 + goto cleanup; 1.176 + 1.177 +- if (setjmp (png_ptr->jmpbuf)) { 1.178 ++ if (setjmp (png_jmpbuf (png_ptr))) { 1.179 + if (desc->preallocated[0].data) { 1.180 + free (desc->preallocated[0].data); 1.181 + desc->preallocated[0].data = NULL; 1.182 +@@ -405,17 +405,22 @@ static DFBResult load_image (const char *filename, 1.183 + } 1.184 + 1.185 + switch (src_format) { 1.186 +- case DSPF_LUT8: 1.187 +- if (info_ptr->num_palette) { 1.188 ++ case DSPF_LUT8: { 1.189 ++ png_colorp png_palette; 1.190 ++ int num_palette; 1.191 ++ 1.192 ++ png_get_PLTE( png_ptr, info_ptr, &png_palette, &num_palette ); 1.193 ++ 1.194 ++ if (num_palette) { 1.195 + png_byte *alpha; 1.196 + int i, num; 1.197 + 1.198 +- *palette_size = MIN (info_ptr->num_palette, 256); 1.199 ++ *palette_size = MIN (num_palette, 256); 1.200 + for (i = 0; i < *palette_size; i++) { 1.201 + palette[i].a = 0xFF; 1.202 +- palette[i].r = info_ptr->palette[i].red; 1.203 +- palette[i].g = info_ptr->palette[i].green; 1.204 +- palette[i].b = info_ptr->palette[i].blue; 1.205 ++ palette[i].r = png_palette[i].red; 1.206 ++ palette[i].g = png_palette[i].green; 1.207 ++ palette[i].b = png_palette[i].blue; 1.208 + } 1.209 + if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) { 1.210 + png_get_tRNS (png_ptr, info_ptr, &alpha, &num, NULL); 1.211 +@@ -424,6 +429,7 @@ static DFBResult load_image (const char *filename, 1.212 + } 1.213 + } 1.214 + break; 1.215 ++ } 1.216 + case DSPF_RGB32: 1.217 + png_set_filler (png_ptr, 0xFF, 1.218 + #ifdef WORDS_BIGENDIAN 1.219 +diff --git a/tools/mkdfiff.c b/tools/mkdfiff.c 1.220 +index 68a3b4f..edb58a7 100644 1.221 +--- a/tools/mkdfiff.c 1.222 ++++ b/tools/mkdfiff.c 1.223 +@@ -97,7 +97,7 @@ load_image (const char *filename, 1.224 + if (!png_ptr) 1.225 + goto cleanup; 1.226 + 1.227 +- if (setjmp (png_ptr->jmpbuf)) { 1.228 ++ if (setjmp (png_jmpbuf (png_ptr))) { 1.229 + if (desc->preallocated[0].data) { 1.230 + free (desc->preallocated[0].data); 1.231 + desc->preallocated[0].data = NULL; 1.232 +diff --git a/tools/mkdgifft.cpp b/tools/mkdgifft.cpp 1.233 +index 96e4220..d4b6bf4 100644 1.234 +--- a/tools/mkdgifft.cpp 1.235 ++++ b/tools/mkdgifft.cpp 1.236 +@@ -595,7 +595,7 @@ load_image (const char *filename, 1.237 + if (!png_ptr) 1.238 + goto cleanup; 1.239 + 1.240 +- if (setjmp (png_ptr->jmpbuf)) { 1.241 ++ if (setjmp (png_jmpbuf (png_ptr))) { 1.242 + if (desc->preallocated[0].data) { 1.243 + free (desc->preallocated[0].data); 1.244 + desc->preallocated[0].data = NULL; 1.245 +-- 1.246 +1.7.4.1 1.247 +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/directfb/stuff/patches/series Sat Nov 04 22:29:34 2017 +0100 2.3 @@ -0,0 +1,1 @@ 2.4 +DirectFB-1.4.9-libpng-1.5.patch
3.1 --- a/eboard/receipt Sat Nov 04 18:41:56 2017 +0100 3.2 +++ b/eboard/receipt Sat Nov 04 22:29:34 2017 +0100 3.3 @@ -18,6 +18,7 @@ 3.4 # Rules to configure and make the package. 3.5 compile_rules() 3.6 { 3.7 + sed -i 's/pngp->//g' cimg.cc 3.8 sed -i 's/strchr(text/strchr((char *)text/' ntext.cc 3.9 ./configure \ 3.10 --prefix=/usr \