You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
142 lines
3.7 KiB
142 lines
3.7 KiB
--- a/gdk_imlib/io-png.c |
|
+++ b/gdk_imlib/io-png.c |
|
@@ -40,13 +40,13 @@ |
|
return NULL; |
|
} |
|
|
|
- if (setjmp(png_ptr->jmpbuf)) |
|
+ if (setjmp(png_jmpbuf(png_ptr))) |
|
{ |
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL); |
|
return NULL; |
|
} |
|
|
|
- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) |
|
+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA) |
|
{ |
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL); |
|
return NULL; |
|
@@ -275,13 +275,13 @@ |
|
return NULL; |
|
} |
|
|
|
- if (setjmp(png_ptr->jmpbuf)) |
|
+ if (setjmp(png_jmpbuf(png_ptr))) |
|
{ |
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL); |
|
return NULL; |
|
} |
|
|
|
- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) |
|
+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA) |
|
{ |
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL); |
|
return NULL; |
|
@@ -301,6 +301,9 @@ |
|
/* Setup Translators */ |
|
if (color_type == PNG_COLOR_TYPE_PALETTE) |
|
png_set_expand(png_ptr); |
|
+ if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) |
|
+ png_set_expand(png_ptr); |
|
+ |
|
png_set_strip_16(png_ptr); |
|
png_set_packing(png_ptr); |
|
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) |
|
@@ -440,13 +443,13 @@ |
|
return NULL; |
|
} |
|
|
|
- if (setjmp(png_ptr->jmpbuf)) |
|
+ if (setjmp(png_jmpbuf(png_ptr))) |
|
{ |
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL); |
|
return NULL; |
|
} |
|
|
|
- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) |
|
+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA) |
|
{ |
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL); |
|
return NULL; |
|
@@ -635,7 +638,7 @@ |
|
png_destroy_write_struct(&png_ptr, (png_infopp) NULL); |
|
return 0; |
|
} |
|
- if (setjmp(png_ptr->jmpbuf)) |
|
+ if (setjmp(png_jmpbuf(png_ptr))) |
|
{ |
|
fclose(f); |
|
png_destroy_write_struct(&png_ptr, (png_infopp) NULL); |
|
--- a/Imlib/load.c |
|
+++ b/Imlib/load.c |
|
@@ -197,12 +197,12 @@ |
|
png_destroy_read_struct(&png_ptr, NULL, NULL); |
|
return NULL; |
|
} |
|
- if (setjmp(png_ptr->jmpbuf)) |
|
+ if (setjmp(png_jmpbuf(png_ptr))) |
|
{ |
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL); |
|
return NULL; |
|
} |
|
- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) |
|
+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA) |
|
{ |
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL); |
|
return NULL; |
|
@@ -260,7 +260,8 @@ |
|
png_read_image(png_ptr, lines); |
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL); |
|
ptr = data; |
|
- if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA) |
|
+ if (color_type == PNG_COLOR_TYPE_GRAY |
|
+ || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) |
|
{ |
|
for (y = 0; y < *h; y++) |
|
{ |
|
@@ -285,6 +286,7 @@ |
|
} |
|
} |
|
} |
|
+#if 0 |
|
else if (color_type == PNG_COLOR_TYPE_GRAY) |
|
{ |
|
for (y = 0; y < *h; y++) |
|
@@ -300,6 +302,7 @@ |
|
} |
|
} |
|
} |
|
+#endif |
|
else |
|
{ |
|
for (y = 0; y < *h; y++) |
|
--- a/Imlib/save.c |
|
+++ b/Imlib/save.c |
|
@@ -342,7 +342,7 @@ |
|
png_destroy_write_struct(&png_ptr, (png_infopp) NULL); |
|
return 0; |
|
} |
|
- if (setjmp(png_ptr->jmpbuf)) |
|
+ if (setjmp(png_jmpbuf(png_ptr))) |
|
{ |
|
fclose(f); |
|
png_destroy_write_struct(&png_ptr, (png_infopp) NULL); |
|
--- a/Imlib/utils.c |
|
+++ b/Imlib/utils.c |
|
@@ -1981,14 +1981,13 @@ |
|
png_destroy_read_struct(&png_ptr, NULL, NULL); |
|
return NULL; |
|
} |
|
- |
|
- if (setjmp(png_ptr->jmpbuf)) |
|
+ if (setjmp(png_jmpbuf(png_ptr))) |
|
{ |
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL); |
|
return NULL; |
|
} |
|
|
|
- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) |
|
+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA) |
|
{ |
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL); |
|
return NULL;
|
|
|