summaryrefslogtreecommitdiff
path: root/x11/fltk/patches/patch-ah
blob: 59784427673a27a8af188fd7fff09c16a05aa49c (plain)
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
$NetBSD: patch-ah,v 1.4 2011/01/14 11:08:20 wiz Exp $

Fix build with png-1.5.

--- src/Fl_PNG_Image.cxx.orig	2006-06-09 16:16:34.000000000 +0000
+++ src/Fl_PNG_Image.cxx
@@ -75,7 +75,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 +87,21 @@ 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)
+  if (png_get_color_type(pp, info) == PNG_COLOR_TYPE_PALETTE)
     png_set_expand(pp);
 
-  if (info->color_type & PNG_COLOR_MASK_COLOR)
-    channels = 3;
-  else
-    channels = 1;
+  channels = png_get_channels(pp, info);
 
-  if ((info->color_type & PNG_COLOR_MASK_ALPHA) || info->num_trans)
-    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)