Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Dec 2014 23:55:20 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r375375 - in head/games/allacrost: . files
Message-ID:  <201412232355.sBNNtK1i027716@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Tue Dec 23 23:55:20 2014
New Revision: 375375
URL: https://svnweb.freebsd.org/changeset/ports/375375
QAT: https://qat.redports.org/buildarchive/r375375/

Log:
  Add a proper patch to support png 1.5
  
  Obtained from:	Archlinux

Added:
  head/games/allacrost/files/patch-src_engine_video_image__base.cpp   (contents, props changed)
Deleted:
  head/games/allacrost/files/patch-src-engine-video-image__base.cpp
Modified:
  head/games/allacrost/Makefile
  head/games/allacrost/files/patch-src-engine-video-image.cpp

Modified: head/games/allacrost/Makefile
==============================================================================
--- head/games/allacrost/Makefile	Tue Dec 23 23:39:53 2014	(r375374)
+++ head/games/allacrost/Makefile	Tue Dec 23 23:55:20 2014	(r375375)
@@ -26,7 +26,7 @@ USE_GL=		yes
 USE_GCC=	any # problems in luabind
 
 CONFIGURE_ARGS=	--datadir=${DATADIR}
-CPPFLAGS+=	-I${LOCALBASE}/include -I${LUA_INCDIR} -I${LOCALBASE}/include/libpng15
+CPPFLAGS+=	-I${LOCALBASE}/include -I${LUA_INCDIR}
 LDFLAGS+=	-L${LOCALBASE}/lib -L${LUA_LIBDIR}
 
 WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}

Modified: head/games/allacrost/files/patch-src-engine-video-image.cpp
==============================================================================
--- head/games/allacrost/files/patch-src-engine-video-image.cpp	Tue Dec 23 23:39:53 2014	(r375374)
+++ head/games/allacrost/files/patch-src-engine-video-image.cpp	Tue Dec 23 23:55:20 2014	(r375375)
@@ -1,10 +1,15 @@
---- src/engine/video/image.cpp.orig	2010-05-17 01:38:27.000000000 +0200
-+++ src/engine/video/image.cpp	2012-05-03 05:56:08.000000000 +0200
-@@ -17,6 +17,7 @@
- #include <math.h>
+--- src/engine/video/image.cpp.orig	2010-05-16 23:38:27 UTC
++++ src/engine/video/image.cpp
+@@ -677,9 +677,9 @@ void ImageDescriptor::_GetPngImageInfo(c
+ 	png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_STRIP_16 | PNG_TRANSFORM_PACKING | PNG_TRANSFORM_EXPAND, NULL);
  
- #include "video.h"
-+#include "pngpriv.h"
+ 	// grab the relevant data...
+-	cols = info_ptr->width;
+-	rows = info_ptr->height;
+-	bpp = info_ptr->channels * 8;
++	cols = png_get_image_width(png_ptr, info_ptr);
++	rows = png_get_image_height(png_ptr, info_ptr);
++	bpp = png_get_channels(png_ptr, info_ptr) * 8;
  
- using namespace std;
- using namespace hoa_utils;
+ 	// and clean up.
+ 	png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);

Added: head/games/allacrost/files/patch-src_engine_video_image__base.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/games/allacrost/files/patch-src_engine_video_image__base.cpp	Tue Dec 23 23:55:20 2014	(r375375)
@@ -0,0 +1,85 @@
+--- src/engine/video/image_base.cpp.orig	2010-05-16 23:38:27 UTC
++++ src/engine/video/image_base.cpp
+@@ -259,9 +259,9 @@ bool ImageMemory::_LoadPngImage(const st
+ 	uint8** row_pointers = png_get_rows(png_ptr, info_ptr);
+ 
+ 	// copy metadata
+-	width = info_ptr->width;
+-	height = info_ptr->height;
+-	pixels = malloc(info_ptr->width * info_ptr->height * 4);
++	width = png_get_image_width(png_ptr, info_ptr);
++	height = png_get_image_height(png_ptr, info_ptr);
++	pixels = malloc(width * height * 4);
+ 
+ 	// check that we were able to allocate enough memory for the PNG
+ 	if (pixels == NULL) {
+@@ -274,18 +274,21 @@ bool ImageMemory::_LoadPngImage(const st
+ 	// convert the damn thing so that it works in our format
+ 	// this is mostly just byteswapping and adding extra data - we want everything in four channels
+ 	// for the moment, anyway
+-	uint32 bpp = info_ptr->channels;
++	uint32 bpp = png_get_channels(png_ptr, info_ptr);
+ 	uint8* img_pixel = NULL;
+ 	uint8* dst_pixel = NULL;
+ 
+-	if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
++	if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE) {
+ 		// colours come from a palette - for this colour type, we have to look up the colour from the palette
++		png_colorp palette;
++		int num_palette;
++		png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette);
+ 		png_color c;
+-		for (uint32 y = 0; y < info_ptr->height; y++) {
+-			for (uint32 x = 0; x < info_ptr->width; x++) {
++		for (uint32 y = 0; y < height; y++) {
++			for (uint32 x = 0; x < width; x++) {
+ 				img_pixel = row_pointers[y] + (x * bpp);
+-				dst_pixel = ((uint8*)pixels) + ((y * info_ptr->width) + x) * 4;
+-				c = info_ptr->palette[img_pixel[0]];
++				dst_pixel = ((uint8*)pixels) + ((y * width) + x) * 4;
++				c = palette[img_pixel[0]];
+ 
+ 				dst_pixel[0] = c.red;
+ 				dst_pixel[1] = c.green;
+@@ -295,10 +298,10 @@ bool ImageMemory::_LoadPngImage(const st
+ 		}
+ 	}
+ 	else if (bpp == 1) {
+-		for (uint32 y = 0; y < info_ptr->height; y++) {
+-			for (uint32 x = 0; x < info_ptr->width; x++) {
++		for (uint32 y = 0; y < height; y++) {
++			for (uint32 x = 0; x < width; x++) {
+ 				img_pixel = row_pointers[y] + (x * bpp);
+-				dst_pixel = ((uint8*)pixels) + ((y * info_ptr->width) + x) * 4;
++				dst_pixel = ((uint8*)pixels) + ((y * width) + x) * 4;
+ 				dst_pixel[0] = img_pixel[0];
+ 				dst_pixel[1] = img_pixel[0];
+ 				dst_pixel[2] = img_pixel[0];
+@@ -307,10 +310,10 @@ bool ImageMemory::_LoadPngImage(const st
+ 		}
+ 	}
+ 	else if (bpp == 3) {
+-		for (uint32 y = 0; y < info_ptr->height; y++) {
+-			for (uint32 x = 0; x < info_ptr->width; x++) {
++		for (uint32 y = 0; y < height; y++) {
++			for (uint32 x = 0; x < width; x++) {
+ 				img_pixel = row_pointers[y] + (x * bpp);
+-				dst_pixel = ((uint8*)pixels) + ((y * info_ptr->width) + x) * 4;
++				dst_pixel = ((uint8*)pixels) + ((y * width) + x) * 4;
+ 				dst_pixel[0] = img_pixel[0];
+ 				dst_pixel[1] = img_pixel[1];
+ 				dst_pixel[2] = img_pixel[2];
+@@ -319,10 +322,10 @@ bool ImageMemory::_LoadPngImage(const st
+ 		}
+ 	}
+ 	else if (bpp == 4) {
+-		for (uint32 y = 0; y < info_ptr->height; y++) {
+-			for (uint32 x = 0; x < info_ptr->width; x++) {
++		for (uint32 y = 0; y < height; y++) {
++			for (uint32 x = 0; x < width; x++) {
+ 				img_pixel = row_pointers[y] + (x * bpp);
+-				dst_pixel = ((uint8*)pixels) + ((y * info_ptr->width) + x) * 4;
++				dst_pixel = ((uint8*)pixels) + ((y * width) + x) * 4;
+ 				dst_pixel[0] = img_pixel[0];
+ 				dst_pixel[1] = img_pixel[1];
+ 				dst_pixel[2] = img_pixel[2];



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412232355.sBNNtK1i027716>