diff options
Diffstat (limited to 'converter/other/pngtopam.c')
-rw-r--r-- | converter/other/pngtopam.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/converter/other/pngtopam.c b/converter/other/pngtopam.c index 9098154a..acb04599 100644 --- a/converter/other/pngtopam.c +++ b/converter/other/pngtopam.c @@ -22,10 +22,6 @@ #include <math.h> #include <float.h> #include <png.h> -/* Because of a design error in png.h, you must not #include <setjmp.h> before - <png.h>. If you do, png.h won't compile. -*/ -#include <setjmp.h> #include <zlib.h> @@ -77,9 +73,7 @@ parseCommandLine(int argc, Note that the strings we return are stored in the storage that was passed to us as the argv array. We also trash *argv. -----------------------------------------------------------------------------*/ - optEntry * option_def; - /* Instructions to pm_optParseOptions3 on how to parse our options. - */ + optEntry * option_def; /* Used by OPTENT3 */ optStruct3 opt; unsigned int option_def_index; @@ -113,7 +107,7 @@ parseCommandLine(int argc, opt.short_allowed = FALSE; /* We have no short (old-fashioned) options */ opt.allowNegNum = FALSE; /* We have no parms that are negative numbers */ - pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0); + pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0); /* Uses and sets argc, argv, and some of *cmdlineP and others. */ @@ -668,10 +662,16 @@ dumpPngInfo(struct pngx * const pngxP) { background.blue); } - if (pngx_chunkIsPresent(pngxP, PNG_INFO_tRNS)) - pm_message("tRNS chunk (transparency): %u entries", - pngx_trns(pngxP).numTrans); - else + if (pngx_chunkIsPresent(pngxP, PNG_INFO_tRNS)) { + struct pngx_trns const trns = pngx_trns(pngxP); + + pm_message("tRNS chunk (transparency):"); + pm_message(" %u palette entries", trns.numTrans); + pm_message(" transparent color = (%u,%u,%u)", + trns.transColor.red, + trns.transColor.green, + trns.transColor.blue); + } else pm_message("tRNS chunk (transparency): not present"); if (pngx_chunkIsPresent(pngxP, PNG_INFO_gAMA)) @@ -868,17 +868,17 @@ paletteHasPartialTransparency(struct pngx * const pngxP) { if (pngx_chunkIsPresent(pngxP, PNG_INFO_tRNS)) { struct pngx_trns const trans = pngx_trns(pngxP); - bool foundGray; + bool foundPartial; unsigned int i; - for (i = 0, foundGray = FALSE; - i < trans.numTrans && !foundGray; + for (i = 0, foundPartial = FALSE; + i < trans.numTrans && !foundPartial; ++i) { if (trans.trans[i] != 0 && trans.trans[i] != pngxP->maxval) { - foundGray = TRUE; + foundPartial = TRUE; } } - retval = foundGray; + retval = foundPartial; } else retval = FALSE; } else @@ -1459,15 +1459,11 @@ convertpng(FILE * const ifP, pngcolor bgColor; GammaCorrection gamma; struct pam pam; - jmp_buf jmpbuf; struct pngx * pngxP; *errorLevelP = 0; - if (setjmp(jmpbuf)) - pm_error ("setjmp returns error condition"); - - pngx_create(&pngxP, PNGX_READ, &jmpbuf); + pngx_create(&pngxP, PNGX_READ, NULL); pngx_readStart(pngxP, ifP); |