aboutsummaryrefslogtreecommitdiff
path: root/graphics/netpbm/files/patch-pngtopnm.c
blob: 8c4615530bbe33d1d4e82a64cf63abe7f04c773f (plain) (blame)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
--- converter/other/pngtopnm.c.orig	2011-11-25 01:15:46.000000000 +0100
+++ converter/other/pngtopnm.c	2012-04-24 22:15:14.000000000 +0200
@@ -37,6 +37,7 @@
 #include <math.h>
 #include <float.h>
 #include <png.h>    /* includes zlib.h and setjmp.h */
+#include <pngpriv.h>
 #define VERSION "2.37.4 (5 December 1999) +netpbm"
 
 #include "pnm.h"
@@ -44,7 +45,7 @@
 #include "nstring.h"
 #include "shhopt.h"
 
-#if PNG_LIBPNG_VER >= 10400
+#if 0
 #error Your PNG library (<png.h>) is incompatible with this Netpbm source code.
 #error You need either an older PNG library (older than 1.4)
 #error newer Netpbm source code (at least 10.48)
@@ -489,7 +490,7 @@
     bool retval;
 
     if (info_ptr->valid & PNG_INFO_tRNS) {
-        const png_color_16 * const transColorP = &info_ptr->trans_values;
+        const png_color_16 * const transColorP = &info_ptr->trans_color;
     
 
         /* There seems to be a problem here: you can't compare real
@@ -582,8 +583,8 @@
             for (i = 0, foundGray = FALSE;
                  i < info_ptr->num_trans && !foundGray;
                  ++i) {
-                if (info_ptr->trans[i] != 0 &&
-                    info_ptr->trans[i] != maxval) {
+                if (info_ptr->trans_alpha[i] != 0 &&
+                    info_ptr->trans_alpha[i] != maxval) {
                     foundGray = TRUE;
                 }
             }
@@ -654,7 +655,7 @@
                 unsigned int i;
                 trans_mix = TRUE;
                 for (i = 0; i < info_ptr->num_trans; ++i)
-                    if (info_ptr->trans[i] != 0 && info_ptr->trans[i] != 255) {
+                    if (info_ptr->trans_alpha[i] != 0 && info_ptr->trans_alpha[i] != 255) {
                         trans_mix = FALSE;
                         break;
                     }
@@ -892,7 +893,7 @@
                 setXel(&xelrow[col], fgColor, bgColor, alpha_handling,
                        ((info_ptr->valid & PNG_INFO_tRNS) &&
                         (fgColor.r == 
-                         gamma_correct(info_ptr->trans_values.gray,
+                         gamma_correct(info_ptr->trans_color.gray,
                                        totalgamma))) ?
                        0 : maxval);
             }
@@ -921,7 +922,7 @@
                 setXel(&xelrow[col], fgColor, bgColor, alpha_handling,
                        (info_ptr->valid & PNG_INFO_tRNS) &&
                        index < info_ptr->num_trans ?
-                       info_ptr->trans[index] : maxval);
+                       info_ptr->trans_alpha[index] : maxval);
             }
             break;