Fix build with png-1.5.

This commit is contained in:
wiz 2011-04-05 11:49:51 +00:00
parent 1eb49075bf
commit 5c65e78e48
2 changed files with 103 additions and 1 deletions

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.29 2010/12/15 16:06:26 abs Exp $
$NetBSD: distinfo,v 1.30 2011/04/05 11:49:51 wiz Exp $
SHA1 (kaffe-1.1.7.tar.gz) = 5951d16a4a7b11689932583d134520ca6de00817
RMD160 (kaffe-1.1.7.tar.gz) = 7523a3470cd06cf60dbade8ea2f464dc9d85277b
@ -17,3 +17,4 @@ SHA1 (patch-bc) = f00d541613db81540bcd21ddc68f7b27232024b6
SHA1 (patch-ca) = 0dc783a8e78016ef5e5e2f3392644690e3a2de9a
SHA1 (patch-cb) = c698b0a2e078cc035dfd7401617fc8d4c2ef5fbe
SHA1 (patch-cc) = df48315c9470d433e33fd80136d7bf7f60f83e1d
SHA1 (patch-libraries_clib_awt_X_imgpng.c) = 0cb5d6ef9349c1f6e1ac1d5885f574f4e2a0aac9

View file

@ -0,0 +1,101 @@
$NetBSD: patch-libraries_clib_awt_X_imgpng.c,v 1.1 2011/04/05 11:49:51 wiz Exp $
Fix build with png-1.5.
--- libraries/clib/awt/X/imgpng.c.orig 2005-07-22 11:42:55.000000000 +0000
+++ libraries/clib/awt/X/imgpng.c
@@ -33,10 +33,10 @@ void reduceAlpha ( Toolkit* tk, Image* i
*/
static inline int
-hasAlpha ( png_structp png_ptr )
+hasAlpha ( png_structp png_ptr, png_infop info_ptr )
{
- return (png_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||
- png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA);
+ return (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY_ALPHA ||
+ png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA);
}
@@ -78,13 +78,13 @@ readRowData ( png_structp png_ptr, png_i
jint argb;
unsigned char *p;
- for ( i = 0; i < info_ptr->height; i++ ) {
+ for ( i = 0; i < png_get_image_height(png_ptr, info_ptr); i++ ) {
png_read_row( png_ptr, row, 0);
- for ( j=0, p=(unsigned char*)row; j<info_ptr->width; j++ ) {
+ for ( j=0, p=(unsigned char*)row; j<png_get_image_width(png_ptr, info_ptr); j++ ) {
argb = readARGB( &p,
(img->alpha != 0)
- || (info_ptr->channels == 4));
+ || (png_get_channels(png_ptr, info_ptr) == 4));
setPixel( img, argb, i, j);
}
}
@@ -99,8 +99,8 @@ readImageData ( png_structp png_ptr, png
png_read_image( png_ptr, rows);
- for ( i=0; i<info_ptr->height; i++ ) {
- for ( j=0, p=(unsigned char*)rows[i]; j<info_ptr->width; j++ ) {
+ for ( i=0; i<png_get_image_height(png_ptr, info_ptr); i++ ) {
+ for ( j=0, p=(unsigned char*)rows[i]; j<png_get_image_width(png_ptr, info_ptr); j++ ) {
argb = readARGB( &p, (img->alpha != 0));
setPixel( img, argb, i, j);
}
@@ -145,13 +145,13 @@ readInterlacedData ( png_structp png_ptr
for ( pass=0; pass<7; pass++ ) {
- for ( i = 0; i < info_ptr->height; i++ ) {
+ for ( i = 0; i < png_get_image_height(png_ptr, info_ptr); i++ ) {
if ( pass ) {
readbackRow( img, row, i);
}
png_read_row( png_ptr, row, 0);
- for ( j=0, p=(unsigned char*)row; j<info_ptr->width; j++ ) {
+ for ( j=0, p=(unsigned char*)row; j<png_get_image_width(png_ptr, info_ptr); j++ ) {
argb = readARGB( &p, (img->alpha != 0));
setPixel( img, argb, i, j);
}
@@ -171,7 +171,7 @@ readPng ( png_structp png_ptr, png_infop
png_bytepp volatile rows = 0;
png_bytep volatile data = 0;
- if ( setjmp(png_ptr->jmpbuf) ) {
+ if ( setjmp(png_jmpbuf(png_ptr)) ) {
if ( img )
imgFreeImage(img);
if ( rows )
@@ -212,21 +212,21 @@ readPng ( png_structp png_ptr, png_infop
row_bytes = png_get_rowbytes( png_ptr, info_ptr);
/* time to create the image */
- img = createImage( info_ptr->width, info_ptr->height);
- if ( hasAlpha( png_ptr) )
+ img = createImage( png_get_image_width(png_ptr, info_ptr), png_get_image_height(png_ptr, info_ptr));
+ if ( hasAlpha( png_ptr, info_ptr ) )
createAlphaImage( X, img);
createXImage( X, img);
- if ( info_ptr->interlace_type != 0 ) {
+ if ( png_get_interlace_type(png_ptr, info_ptr) != 0 ) {
#ifndef OPTIMIZE_SPACE
/*
* This is bad: to read an interlaced image, we need enough space to (temporarily)
* store the whole transformed data (passes need prev. results). Unfortunately,
* interlacing is used for large images, and this might require a LOT of memory.
*/
- rows = AWT_MALLOC( sizeof(png_bytep) * info_ptr->height);
- data = AWT_MALLOC( row_bytes * info_ptr->height);
- for ( i=0; i<info_ptr->height; i++ )
+ rows = AWT_MALLOC( sizeof(png_bytep) * png_get_image_height(png_ptr, info_ptr));
+ data = AWT_MALLOC( row_bytes * png_get_image_height(png_ptr, info_ptr));
+ for ( i=0; i<png_get_image_height(png_ptr, info_ptr); i++ )
rows[i] = (data + i*row_bytes);
readImageData( png_ptr, info_ptr, rows, img);