summaryrefslogtreecommitdiff
path: root/src/webpng.c
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2017-08-25 12:13:19 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2017-08-25 12:13:19 +0200
commit1c090dc01e3c9957f2ac051b6299d44a3379c40f (patch)
tree477ea1b9e7e7dc5812a91989a0628ffa9654963c /src/webpng.c
parentb7977b574dbbb1ba7d3e109e55ab08b7d76fb42a (diff)
downloadlibgd-1c090dc01e3c9957f2ac051b6299d44a3379c40f.tar.gz
Fix #406: webpng -i removes the transparent color
We have to initialize `trans_col` to the value that guards the call to `gdImageColorTransparent()`. To avoid confusion, we replace the magic numbers with a macro.
Diffstat (limited to 'src/webpng.c')
-rw-r--r--src/webpng.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/webpng.c b/src/webpng.c
index 6faa909..2dff832 100644
--- a/src/webpng.c
+++ b/src/webpng.c
@@ -26,6 +26,8 @@
/* Bring in the gd library functions */
#include "gd.h"
+#define KEEP_TRANS (-100)
+
static const char argv0[] = "webpng";
static void usage(const char *msg)
@@ -74,7 +76,7 @@ main(int argc, char **argv)
int interlace = -100;
int list_color_table = 0;
- int trans_col = -1;
+ int trans_col = KEEP_TRANS;
int report_details = 0;
int print_alpha = 0;
@@ -251,7 +253,7 @@ main(int argc, char **argv)
else if (interlace == 0)
gdImageInterlace(im, 0);
- if (trans_col != -100)
+ if (trans_col != KEEP_TRANS)
gdImageColorTransparent(im, trans_col);
if (use_stdin_stdout) {