slackbuilds/multimedia/stills2dv/libpng.patch

58 lines
1.9 KiB
Diff

--- stills2dv-alpha-0.602/s2d_png.c.orig 2016-02-13 22:37:33.318517038 +0700
+++ stills2dv-alpha-0.602/s2d_png.c 2016-02-13 22:49:22.996228344 +0700
@@ -75,8 +75,8 @@
png_init_io(png_ptr, in);
png_set_sig_bytes(png_ptr, 8);
png_read_info(png_ptr, info_ptr);
- width = info_ptr->width;
- height = info_ptr->height;
+ width = png_get_image_width(png_ptr, info_ptr);;
+ height = png_get_image_height(png_ptr, info_ptr);
png_set_interlace_handling(png_ptr);
png_read_update_info(png_ptr, info_ptr);
if (setjmp(png_jmpbuf(png_ptr)))
@@ -91,7 +91,7 @@
return NULL;
}
for (y=0; y<height; y++)
- if((row_pointers[y] = (unsigned char *) malloc(info_ptr->rowbytes))==NULL)
+ if((row_pointers[y] = (unsigned char *) malloc(png_get_rowbytes(png_ptr, info_ptr)))==NULL)
{
fprintf(stderr, "Out of memory allocating rows for png\n");
while(y>1)
@@ -128,14 +128,14 @@
free(img);
return NULL;
}
- if(info_ptr->color_type == PNG_COLOR_TYPE_RGB)
+ if(png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB)
{
for (y=0;y<height;y++)
{
memcpy(&img->data[y*width*3], row_pointers[y], width*3);
}
- }else if (info_ptr->color_type == PNG_COLOR_TYPE_RGBA)
+ }else if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGBA)
{
data=img->data;
for (y=0;y<height;y++)
@@ -149,7 +149,7 @@
row++;
}
}
- }else if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY)
+ }else if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY)
{
data=img->data;
for (y=0;y<height;y++)
@@ -162,7 +162,7 @@
*(data++)=*(row++);
}
}
- }else if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+ }else if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY_ALPHA)
{
data=img->data;
for (y=0;y<height;y++)