1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
--- 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++)
|