diff options
Diffstat (limited to 'games')
-rw-r--r-- | games/genecys-client/distinfo | 3 | ||||
-rw-r--r-- | games/genecys-client/patches/patch-common_pngloader.c | 118 |
2 files changed, 120 insertions, 1 deletions
diff --git a/games/genecys-client/distinfo b/games/genecys-client/distinfo index e3456ad4341..395d738add3 100644 --- a/games/genecys-client/distinfo +++ b/games/genecys-client/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.5 2006/05/06 12:45:32 joerg Exp $ +$NetBSD: distinfo,v 1.6 2011/04/03 11:14:14 wiz Exp $ SHA1 (genecys-0.2.tar.gz) = 0140f91e1469237a385437ac7b2e6030902de110 RMD160 (genecys-0.2.tar.gz) = 0039088028aae5f993a77d50c6d1c856ee61967d @@ -8,3 +8,4 @@ SHA1 (patch-ab) = 6a9b73b9d45779bdc57061bed9baf058a3433c1f SHA1 (patch-ac) = d178b0adbb8ace283e248afa1c1d946b7c439c22 SHA1 (patch-ad) = d5ba82edcfe988022d073d73bd780e77e2a8672e SHA1 (patch-ae) = 2d5f2c04bccc4854796490ff3aa4982e2253f677 +SHA1 (patch-common_pngloader.c) = b06be99d01157dd201d64b73c1004b6662c10a63 diff --git a/games/genecys-client/patches/patch-common_pngloader.c b/games/genecys-client/patches/patch-common_pngloader.c new file mode 100644 index 00000000000..20d15b077fb --- /dev/null +++ b/games/genecys-client/patches/patch-common_pngloader.c @@ -0,0 +1,118 @@ +$NetBSD: patch-common_pngloader.c,v 1.1 2011/04/03 11:14:14 wiz Exp $ + +Fix build with png-1.5. + +--- common/pngloader.c.orig 2004-03-17 03:43:53.000000000 +0000 ++++ common/pngloader.c +@@ -90,10 +90,10 @@ uint8_t **parse_pngmap8bit(char* file_na + + png_read_info(png_ptr, info_ptr); + +- if (width != info_ptr->width || height != info_ptr->height) ++ if (width != png_get_image_width(png_ptr, info_ptr) || height != png_get_image_height(png_ptr, info_ptr)) + LOG(LOG_FATAL, "width/height of map do not match that of image"); +- color_type = info_ptr->color_type; +- bit_depth = info_ptr->bit_depth; ++ color_type = png_get_color_type(png_ptr, info_ptr); ++ bit_depth = png_get_bit_depth(png_ptr, info_ptr); + + number_of_passes = png_set_interlace_handling(png_ptr); + png_read_update_info(png_ptr, info_ptr); +@@ -104,11 +104,11 @@ uint8_t **parse_pngmap8bit(char* file_na + + row_pointers = (png_bytep*) malloc(sizeof(png_bytep) * height); + for (y=0; y<height; y++) +- row_pointers[y] = (png_byte*) malloc(info_ptr->rowbytes); ++ row_pointers[y] = (png_byte*) malloc(png_get_rowbytes(png_ptr, info_ptr)); + + png_read_image(png_ptr, row_pointers); + +- if (info_ptr->color_type != PNG_COLOR_TYPE_GRAY) ++ if (png_get_color_type(png_ptr, info_ptr) != PNG_COLOR_TYPE_GRAY) + LOG(LOG_FATAL, "Image %s is not grayscale", file_name); + + map = safer_malloc(sizeof(uint8_t *) * height); +@@ -172,10 +172,10 @@ int16_t **parse_pngmap16bit(char* file_n + + png_read_info(png_ptr, info_ptr); + +- if (width != info_ptr->width || height != info_ptr->height) ++ if (width != png_get_image_width(png_ptr, info_ptr) || height != png_get_image_height(png_ptr, info_ptr)) + LOG(LOG_FATAL, "width/height of map do not match that of image"); +- color_type = info_ptr->color_type; +- bit_depth = info_ptr->bit_depth; ++ color_type = png_get_color_type(png_ptr, info_ptr); ++ bit_depth = png_get_bit_depth(png_ptr, info_ptr); + + number_of_passes = png_set_interlace_handling(png_ptr); + png_read_update_info(png_ptr, info_ptr); +@@ -186,11 +186,11 @@ int16_t **parse_pngmap16bit(char* file_n + + row_pointers = (png_bytep*) malloc(sizeof(png_bytep) * height); + for (y=0; y<height; y++) +- row_pointers[y] = (png_byte*) malloc(info_ptr->rowbytes); ++ row_pointers[y] = (png_byte*) malloc(png_get_rowbytes(png_ptr, info_ptr)); + + png_read_image(png_ptr, row_pointers); + +- if (info_ptr->color_type != PNG_COLOR_TYPE_RGB) ++ if (png_get_color_type(png_ptr, info_ptr) != PNG_COLOR_TYPE_RGB) + LOG(LOG_FATAL, "Image %s is not RGB", file_name); + + map = safer_malloc(sizeof(int16_t *) * height); +@@ -254,10 +254,10 @@ uint8_t *parse_pngRGBA(char* file_name, + + png_read_info(png_ptr, info_ptr); + +- /*if (width != info_ptr->width || height != info_ptr->height) ++ /*if (width != png_get_image_width(png_ptr, info_ptr) || height != png_get_image_height(png_ptr, info_ptr)) + LOG(LOG_FATAL, "width/height of map do not match that of image");*/ +- color_type = info_ptr->color_type; +- bit_depth = info_ptr->bit_depth; ++ color_type = png_get_color_type(png_ptr, info_ptr); ++ bit_depth = png_get_bit_depth(png_ptr, info_ptr); + + number_of_passes = png_set_interlace_handling(png_ptr); + png_read_update_info(png_ptr, info_ptr); +@@ -266,30 +266,30 @@ uint8_t *parse_pngRGBA(char* file_name, + if (setjmp(png_jmpbuf(png_ptr))) + bailout(); + +- row_pointers = (png_bytep*) malloc(sizeof(png_bytep) * info_ptr->height); +- for (y=0; y < info_ptr->height; y++) +- row_pointers[y] = (png_byte*) malloc(info_ptr->rowbytes); ++ row_pointers = (png_bytep*) malloc(sizeof(png_bytep) * png_get_image_height(png_ptr, info_ptr)); ++ for (y=0; y < png_get_image_height(png_ptr, info_ptr); y++) ++ row_pointers[y] = (png_byte*) malloc(png_get_rowbytes(png_ptr, info_ptr)); + + png_read_image(png_ptr, row_pointers); + +- if (info_ptr->color_type != PNG_COLOR_TYPE_RGBA) ++ if (png_get_color_type(png_ptr, info_ptr) != PNG_COLOR_TYPE_RGBA) + LOG(LOG_FATAL, "Image %s is not RGBA", file_name); + +- row_stride = info_ptr->width * 4; ++ row_stride = png_get_image_width(png_ptr, info_ptr) * 4; + +- map = safer_malloc(sizeof(uint8_t) * info_ptr->height * +- info_ptr->width * 4); ++ map = safer_malloc(sizeof(uint8_t) * png_get_image_height(png_ptr, info_ptr) * ++ png_get_image_width(png_ptr, info_ptr) * 4); + +-/* indx = row_stride * (info_ptr->height-1); */ ++/* indx = row_stride * (png_get_image_height(png_ptr, info_ptr)-1); */ + indx = 0; +- for (y=0; y < info_ptr->height; y++) { ++ for (y=0; y < png_get_image_height(png_ptr, info_ptr); y++) { + png_byte* row = row_pointers[y]; + memcpy(map+indx, row, row_stride); + indx += row_stride; + } + +- *height = info_ptr->height; +- *width = info_ptr->width; ++ *height = png_get_image_height(png_ptr, info_ptr); ++ *width = png_get_image_width(png_ptr, info_ptr); + + return(map); + } |