From 00e859a5c9d76375cc15713eb11507075e60462d Mon Sep 17 00:00:00 2001 From: wiz Date: Tue, 5 Apr 2011 11:27:28 +0000 Subject: Fix build with png-1.5. --- games/ufoai/distinfo | 4 ++-- games/ufoai/patches/patch-ab | 51 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 3 deletions(-) (limited to 'games/ufoai') diff --git a/games/ufoai/distinfo b/games/ufoai/distinfo index a34439d7bd9..b836f1a59b6 100644 --- a/games/ufoai/distinfo +++ b/games/ufoai/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.4 2010/06/13 22:44:24 wiz Exp $ +$NetBSD: distinfo,v 1.5 2011/04/05 11:32:46 wiz Exp $ SHA1 (ufoai-2.2.1-data.tar) = eb071333478bd6860179e12d8655301980f87d60 RMD160 (ufoai-2.2.1-data.tar) = af91dd473f59c73e705181759059bd37ba215f62 @@ -10,5 +10,5 @@ SHA1 (ufoai-2.2.1-source.tar.bz2) = 6ad1b8c357fdbbe9a31839b3bf8de46ad17a40eb RMD160 (ufoai-2.2.1-source.tar.bz2) = 980405a5d38bcbb5ae2cea4e25c54374c7dd8e99 Size (ufoai-2.2.1-source.tar.bz2) = 7640531 bytes SHA1 (patch-aa) = 2b196e8d94a1848b42212f32c90a259e56440382 -SHA1 (patch-ab) = 3700077a35ba84648b52449be047b39f1274c9ee +SHA1 (patch-ab) = 0d02436454b3dbd85b8027fcf321714be8bf05a2 SHA1 (patch-ac) = 29069a06c2442060734e32162a9b561c19be8739 diff --git a/games/ufoai/patches/patch-ab b/games/ufoai/patches/patch-ab index dd63ad87264..24f7e559ae5 100644 --- a/games/ufoai/patches/patch-ab +++ b/games/ufoai/patches/patch-ab @@ -1,4 +1,8 @@ -$NetBSD: patch-ab,v 1.2 2010/06/13 22:44:24 wiz Exp $ +$NetBSD: patch-ab,v 1.3 2011/04/05 11:32:46 wiz Exp $ + +Fix build with png-1.5. + +Last chunk: ? --- src/renderer/r_image.c.orig 2008-04-25 16:15:02.000000000 +0000 +++ src/renderer/r_image.c @@ -11,6 +15,51 @@ $NetBSD: patch-ab,v 1.2 2010/06/13 22:44:24 wiz Exp $ if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr); +@@ -268,32 +268,32 @@ static int R_LoadPNG (const char *name, + row_pointers = png_get_rows(png_ptr, info_ptr); + rowptr = 0; + +- img = VID_TagAlloc(vid_imagePool, info_ptr->width * info_ptr->height * 4, 0); ++ img = VID_TagAlloc(vid_imagePool, png_get_image_width(png_ptr, info_ptr) * png_get_image_height(png_ptr, info_ptr) * 4, 0); + if (pic) + *pic = img; + +- if (info_ptr->channels == 4) { +- for (i = 0; i < info_ptr->height; i++) { +- memcpy (img + rowptr, row_pointers[i], info_ptr->rowbytes); +- rowptr += info_ptr->rowbytes; ++ if (png_get_channels(png_ptr, info_ptr) == 4) { ++ for (i = 0; i < png_get_image_height(png_ptr, info_ptr); i++) { ++ memcpy (img + rowptr, row_pointers[i], png_get_rowbytes(png_ptr, info_ptr)); ++ rowptr += png_get_rowbytes(png_ptr, info_ptr); + } + } else { + uint32_t j; + +- memset(img, 255, info_ptr->width * info_ptr->height * 4); +- for (rowptr = 0, i = 0; i < info_ptr->height; i++) { +- for (j = 0; j < info_ptr->rowbytes; j += info_ptr->channels) { +- memcpy(img + rowptr, row_pointers[i] + j, info_ptr->channels); ++ memset(img, 255, png_get_image_width(png_ptr, info_ptr) * png_get_image_height(png_ptr, info_ptr) * 4); ++ for (rowptr = 0, i = 0; i < png_get_image_height(png_ptr, info_ptr); i++) { ++ for (j = 0; j < png_get_rowbytes(png_ptr, info_ptr); j += png_get_channels(png_ptr, info_ptr)) { ++ memcpy(img + rowptr, row_pointers[i] + j, png_get_channels(png_ptr, info_ptr)); + rowptr += 4; + } + } + } + + if (width) +- *width = info_ptr->width; ++ *width = png_get_image_width(png_ptr, info_ptr); + if (height) +- *height = info_ptr->height; +- samples = info_ptr->channels; ++ *height = png_get_image_height(png_ptr, info_ptr); ++ samples = png_get_channels(png_ptr, info_ptr); + + png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); + @@ -651,17 +651,6 @@ static void jpg_skip_input_data (j_decom cinfo->src->bytes_in_buffer -= (size_t) num_bytes; } -- cgit v1.2.3