diff options
-rw-r--r-- | libraries/fltk/fltk-1.1.10_libpng.patch | 61 | ||||
-rw-r--r-- | libraries/fltk/fltk.SlackBuild | 3 |
2 files changed, 64 insertions, 0 deletions
diff --git a/libraries/fltk/fltk-1.1.10_libpng.patch b/libraries/fltk/fltk-1.1.10_libpng.patch new file mode 100644 index 000000000000..1b6d91ed7e5e --- /dev/null +++ b/libraries/fltk/fltk-1.1.10_libpng.patch @@ -0,0 +1,61 @@ +--- fltk1.1-1.1.10.orig/src/Fl_PNG_Image.cxx ++++ fltk1.1-1.1.10/src/Fl_PNG_Image.cxx +@@ -66,6 +66,8 @@ Fl_PNG_Image::Fl_PNG_Image(const char *p + png_structp pp; // PNG read pointer + png_infop info; // PNG info pointers + png_bytep *rows; // PNG row pointers ++ png_uint_32 width, height; ++ int bit_depth, color_type, num_trans = 0; + + + // Open the PNG file... +@@ -75,7 +77,7 @@ Fl_PNG_Image::Fl_PNG_Image(const char *p + 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 +89,33 @@ Fl_PNG_Image::Fl_PNG_Image(const char *p + // Get the image dimensions and convert to grayscale or RGB... + png_read_info(pp, info); + +- if (info->color_type == PNG_COLOR_TYPE_PALETTE) ++ png_get_IHDR(pp, info, &width, &height, &bit_depth, &color_type, ++ NULL /* interlace */, NULL /* compress */, NULL /* filter */); ++#ifdef PNG_tRNS_SUPPORTED ++ png_get_tRNS(pp, info, NULL /* trans */, &num_trans, NULL /* values */); ++#endif ++ ++ if (color_type == PNG_COLOR_TYPE_PALETTE) + png_set_expand(pp); + +- if (info->color_type & PNG_COLOR_MASK_COLOR) ++ if (color_type & PNG_COLOR_MASK_COLOR) + channels = 3; + else + channels = 1; + +- if ((info->color_type & PNG_COLOR_MASK_ALPHA) || info->num_trans) ++ if ((color_type & PNG_COLOR_MASK_ALPHA) || num_trans) + channels ++; + +- w((int)(info->width)); +- h((int)(info->height)); ++ w((int)(width)); ++ h((int)(height)); + d(channels); + +- if (info->bit_depth < 8) ++ if (bit_depth < 8) + { + png_set_packing(pp); + png_set_expand(pp); + } +- else if (info->bit_depth == 16) ++ else if (bit_depth == 16) + png_set_strip_16(pp); + + # if defined(HAVE_PNG_GET_VALID) && defined(HAVE_PNG_SET_TRNS_TO_ALPHA) diff --git a/libraries/fltk/fltk.SlackBuild b/libraries/fltk/fltk.SlackBuild index ba899ee152b6..3216b7a0bbe2 100644 --- a/libraries/fltk/fltk.SlackBuild +++ b/libraries/fltk/fltk.SlackBuild @@ -80,6 +80,9 @@ sed -i \ -e '/RANLIB/s:$(libdir)/\(.*LIBNAME)\):$(libdir)/`basename \1`:g' \ src/Makefile || exit +# Fix for libpng16 (-current) snarfed from Debian ;-) +patch -p1 < $CWD/fltk-1.1.10_libpng.patch + # --docdir seems to be ignored CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ |