summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2010-11-14 21:17:31 +0000
committerMatthias Melcher <fltk@matthiasm.com>2010-11-14 21:17:31 +0000
commit160973c8767758785510f8faaab3d1479ef762db (patch)
tree2c2a29199002fa437101e3322123587d60793ff7 /src
parent6e863f844dca65c5d4506c9040cd075a31e72212 (diff)
Update lib png access (STR #2442)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7832 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_PNG_Image.cxx20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/Fl_PNG_Image.cxx b/src/Fl_PNG_Image.cxx
index 021cf6875..5efe6857f 100644
--- a/src/Fl_PNG_Image.cxx
+++ b/src/Fl_PNG_Image.cxx
@@ -78,7 +78,7 @@ Fl_PNG_Image::Fl_PNG_Image(const char *png) // I - File to read
pp = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
info = png_create_info_struct(pp);
- if (setjmp(pp->jmpbuf))
+ if (setjmp(png_jmpbuf(pp)))
{
Fl::warning("PNG file \"%s\" contains errors!\n", png);
return;
@@ -90,27 +90,29 @@ Fl_PNG_Image::Fl_PNG_Image(const char *png) // I - File to read
// Get the image dimensions and convert to grayscale or RGB...
png_read_info(pp, info);
- if (info->color_type == PNG_COLOR_TYPE_PALETTE)
+ if (png_get_color_type(pp, info) == PNG_COLOR_TYPE_PALETTE)
png_set_expand(pp);
- if (info->color_type & PNG_COLOR_MASK_COLOR)
+ if (png_get_color_type(pp, info) & PNG_COLOR_MASK_COLOR)
channels = 3;
else
channels = 1;
- if ((info->color_type & PNG_COLOR_MASK_ALPHA) || info->num_trans)
- channels ++;
+ int num_trans;
+ png_get_tRNS(pp, info, 0, &num_trans, 0);
+ if ((png_get_color_type(pp, info) & PNG_COLOR_MASK_ALPHA) || (num_trans != 0))
+ channels ++;
- w((int)(info->width));
- h((int)(info->height));
+ w((int)(png_get_image_width(pp, info)));
+ h((int)(png_get_image_height(pp, info)));
d(channels);
- if (info->bit_depth < 8)
+ if (png_get_bit_depth(pp, info) < 8)
{
png_set_packing(pp);
png_set_expand(pp);
}
- else if (info->bit_depth == 16)
+ else if (png_get_bit_depth(pp, info) == 16)
png_set_strip_16(pp);
# if defined(HAVE_PNG_GET_VALID) && defined(HAVE_PNG_SET_TRNS_TO_ALPHA)