Author: AlbrechtS
Date: 2011-03-20 06:44:20 -0700 (Sun, 20 Mar 2011)
New Revision: 8520
Log:
Updated libpng access functions for libpng 1.5 and higher (STR #2542).
Modified:
branches/branch-1.1/CHANGES
branches/branch-1.1/src/Fl_PNG_Image.cxx
Modified: branches/branch-1.1/CHANGES
===================================================================
--- branches/branch-1.1/CHANGES 2011-03-20 11:15:14 UTC (rev 8519)
+++ branches/branch-1.1/CHANGES 2011-03-20 13:44:20 UTC (rev 8520)
@@ -1,5 +1,6 @@
CHANGES IN FLTK 1.1.11
+ - Update libpng access for libpng 1.5 and higher (STR #2542)
- Fixed linker issue (missing -lfontconfig) when configured with
--enable-xft (STR #2570)
- Fixed fluid desktop file (STR #2328)
Modified: branches/branch-1.1/src/Fl_PNG_Image.cxx
===================================================================
--- branches/branch-1.1/src/Fl_PNG_Image.cxx 2011-03-20 11:15:14 UTC (rev
8519)
+++ branches/branch-1.1/src/Fl_PNG_Image.cxx 2011-03-20 13:44:20 UTC (rev
8520)
@@ -75,7 +75,7 @@
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;
@@ -87,27 +87,29 @@
// 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)
+ int num_trans = 0;
+ 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)
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit