Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Dec 2014 11:03:56 +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: r375531 - head/games/egl/files
Message-ID:  <201412251103.sBPB3u89040486@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Thu Dec 25 11:03:55 2014
New Revision: 375531
URL: https://svnweb.freebsd.org/changeset/ports/375531
QAT: https://qat.redports.org/buildarchive/r375531/

Log:
  Properly support png 1.5

Modified:
  head/games/egl/files/patch-renderer__rf_image.c

Modified: head/games/egl/files/patch-renderer__rf_image.c
==============================================================================
--- head/games/egl/files/patch-renderer__rf_image.c	Thu Dec 25 10:49:46 2014	(r375530)
+++ head/games/egl/files/patch-renderer__rf_image.c	Thu Dec 25 11:03:55 2014	(r375531)
@@ -1,14 +1,14 @@
---- renderer/rf_image.c.orig	2012-04-29 06:34:41.000000000 +0200
-+++ renderer/rf_image.c	2012-04-29 06:35:42.000000000 +0200
-@@ -32,6 +32,7 @@
+--- renderer/rf_image.c.orig	2014-12-25 10:53:09 UTC
++++ renderer/rf_image.c
+@@ -32,6 +32,7 @@ Foundation, Inc., 59 Temple Place - Suit
  #else
  # include <jpeglib.h>
  # include <png.h>
-+# include <pngpriv.h>
++# include <zlib.h>
  #endif
  
  #define MAX_IMAGE_HASH			(MAX_IMAGES/4)
-@@ -44,7 +45,7 @@
+@@ -44,7 +45,7 @@ static uint32	*r_imageResampleScratch;
  image_t			*r_lmTextures[R_MAX_LIGHTMAPS];
  static image_t	r_imageList[MAX_IMAGES];
  static image_t	*r_imageHashTree[MAX_IMAGE_HASH];
@@ -17,7 +17,7 @@
  
  static byte		r_intensityTable[256];
  static byte		r_gammaTable[256];
-@@ -261,21 +262,6 @@
+@@ -261,21 +262,6 @@ static void jpg_skip_input_data(j_decomp
      cinfo->src->bytes_in_buffer -= (size_t) num_bytes;
  }
  
@@ -39,12 +39,76 @@
  /*
  =============
  R_LoadJPG
-@@ -610,7 +596,7 @@
+@@ -601,46 +587,46 @@ static void R_LoadPNG (char *name, byte 
+ 	png_read_info (png_ptr, info_ptr);
+ 
+ 	// Color
+-	if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
++	if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE) {
+ 		png_set_palette_to_rgb (png_ptr);
+ 		png_read_update_info (png_ptr, info_ptr);
+ 	}
+ 
+-	if (info_ptr->color_type == PNG_COLOR_TYPE_RGB)
++	if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB)
  		png_set_filler (png_ptr, 0xFF, PNG_FILLER_AFTER);
  
- 	if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY && info_ptr->bit_depth < 8)
+-	if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY && info_ptr->bit_depth < 8)
 -		png_set_gray_1_2_4_to_8 (png_ptr);
++	if (png_get_color_type(png_ptr, info_ptr)  == PNG_COLOR_TYPE_GRAY && png_get_bit_depth(png_ptr, info_ptr) < 8)
 +		png_set_expand_gray_1_2_4_to_8 (png_ptr);
  
  	if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS))
  		png_set_tRNS_to_alpha (png_ptr);
+ 
+-	if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY || info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
++	if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY || png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY_ALPHA)
+ 		png_set_gray_to_rgb (png_ptr);
+ 
+-	if (info_ptr->bit_depth == 16)
++	if (png_get_bit_depth(png_ptr, info_ptr) == 16)
+ 		png_set_strip_16 (png_ptr);
+ 
+-	if (info_ptr->bit_depth < 8)
++	if (png_get_bit_depth(png_ptr, info_ptr) < 8)
+         png_set_packing (png_ptr);
+ 
+ 	png_read_update_info (png_ptr, info_ptr);
+ 
+ 	rowbytes = png_get_rowbytes (png_ptr, info_ptr);
+ 
+-	if (!info_ptr->channels) {
++	if (!png_get_channels(png_ptr, info_ptr)) {
+ 		png_destroy_read_struct (&png_ptr, &info_ptr, (png_infopp)NULL);
+ 		Com_Printf (PRNT_WARNING, "R_LoadPNG: Bad PNG file: %s\n", name);
+ 		FS_FreeFile (PngFileBuffer.buffer);
+ 	}
+ 
+-	pic_ptr = Mem_PoolAllocExt (info_ptr->height * rowbytes, qFalse, ri.imageSysPool, r_imageAllocTag);
++	pic_ptr = Mem_PoolAllocExt (png_get_image_height(png_ptr, info_ptr) * rowbytes, qFalse, ri.imageSysPool, r_imageAllocTag);
+ 	if (pic)
+ 		*pic = pic_ptr;
+ 
+-	row_pointers = Mem_PoolAllocExt (sizeof (png_bytep) * info_ptr->height, qFalse, ri.imageSysPool, r_imageAllocTag);
++	row_pointers = Mem_PoolAllocExt (sizeof (png_bytep) * png_get_image_height(png_ptr, info_ptr), qFalse, ri.imageSysPool, r_imageAllocTag);
+ 
+-	for (i=0 ; i<info_ptr->height ; i++) {
++	for (i=0 ; i<png_get_image_height(png_ptr, info_ptr) ; i++) {
+ 		row_pointers[i] = pic_ptr;
+ 		pic_ptr += rowbytes;
+ 	}
+@@ -648,11 +634,11 @@ static void R_LoadPNG (char *name, byte 
+ 	png_read_image (png_ptr, row_pointers);
+ 
+ 	if (width)
+-		*width = info_ptr->width;
++		*width = png_get_image_width(png_ptr, info_ptr);
+ 	if (height)
+-		*height = info_ptr->height;
++		*height = png_get_image_height(png_ptr, info_ptr);
+ 	if (samples)
+-		*samples = info_ptr->channels;
++		*samples = png_get_channels(png_ptr, info_ptr);
+ 
+ 	png_read_end (png_ptr, end_info);
+ 	png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);



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