diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2019-05-04 19:39:29 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2019-05-04 19:39:29 +0000 |
commit | 7a5291a126732a4ca220a79cfe5e6763e71ace73 (patch) | |
tree | 4faec99c44fe17269a2a91bca124f82dea7a5ae0 | |
parent | d58c8eb1d4269c9210171b47bcf0bb855ceabbb3 (diff) | |
download | netpbm-mirror-7a5291a126732a4ca220a79cfe5e6763e71ace73.tar.gz netpbm-mirror-7a5291a126732a4ca220a79cfe5e6763e71ace73.tar.xz netpbm-mirror-7a5291a126732a4ca220a79cfe5e6763e71ace73.zip |
Release 10.86.03
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@3602 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r-- | converter/other/pnmtopng.c | 70 | ||||
-rw-r--r-- | doc/HISTORY | 16 | ||||
-rw-r--r-- | editor/pnmcrop.c | 4 | ||||
-rw-r--r-- | version.mk | 2 |
4 files changed, 71 insertions, 21 deletions
diff --git a/converter/other/pnmtopng.c b/converter/other/pnmtopng.c index 80f74adb..60b8276b 100644 --- a/converter/other/pnmtopng.c +++ b/converter/other/pnmtopng.c @@ -127,6 +127,7 @@ struct cmdlineInfo { unsigned int modtimeSpec; time_t modtime; /* Meaningless if !modtimeSpec */ const char * palette; /* NULL if none */ + bool filterSetSpec; int filterSet; unsigned int force; unsigned int libversion; @@ -422,15 +423,17 @@ parseCommandLine(int argc, const char ** argv, if (!paletteSpec) cmdlineP->palette = NULL; - if (filterSpec + nofilter + sub + up + avg + paeth > 1) - pm_error("You may specify at most one of " - "-nofilter, -sub, -up, -avg, -paeth, and -filter"); + if (filterSpec && (nofilter + sub + up + avg + paeth > 0)) + pm_error("You may mot specify -filter with " + "-nofilter, -sub, -up, -avg, or -paeth"); if (filterSpec) { if (filter < 0 || filter > 4) pm_error("-filter is obsolete. Use -nofilter, -sub, -up, -avg, " "and -paeth options instead."); - else + else { + cmdlineP->filterSetSpec = true; + switch (filter) { case 0: cmdlineP->filterSet = PNG_FILTER_NONE; break; case 1: cmdlineP->filterSet = PNG_FILTER_SUB; break; @@ -438,21 +441,25 @@ parseCommandLine(int argc, const char ** argv, case 3: cmdlineP->filterSet = PNG_FILTER_AVG; break; case 4: cmdlineP->filterSet = PNG_FILTER_PAETH; break; } + } } else { - if (nofilter) - cmdlineP->filterSet = PNG_FILTER_NONE; - else if (sub) - cmdlineP->filterSet = PNG_FILTER_SUB; - else if (up) - cmdlineP->filterSet = PNG_FILTER_UP; - else if (avg) - cmdlineP->filterSet = PNG_FILTER_AVG; - else if (paeth) - cmdlineP->filterSet = PNG_FILTER_PAETH; - else - cmdlineP->filterSet = PNG_FILTER_NONE; + if (nofilter + sub + up + avg + paeth == 0) + cmdlineP->filterSetSpec = false; + else { + cmdlineP->filterSetSpec = true; + cmdlineP->filterSet = PNG_NO_FILTERS; /* initial value */ + if (nofilter) + cmdlineP->filterSet |= PNG_FILTER_NONE; + if (sub) + cmdlineP->filterSet |= PNG_FILTER_SUB; + if (up) + cmdlineP->filterSet |= PNG_FILTER_UP; + if (avg) + cmdlineP->filterSet |= PNG_FILTER_AVG; + if (paeth) + cmdlineP->filterSet |= PNG_FILTER_PAETH; + } } - if (cmdlineP->sizeSpec) parseSizeOpt(size, &cmdlineP->size); @@ -2501,6 +2508,32 @@ doTimeChunk(struct cmdlineInfo const cmdline, static void +reportFilterSet(int const filterSet) { + + pm_message("Limiting filter to: %s%s%s%s%s", + (filterSet & PNG_FILTER_NONE) ? "NONE " : "", + (filterSet & PNG_FILTER_SUB) ? "SUB " : "", + (filterSet & PNG_FILTER_UP) ? "UP " : "", + (filterSet & PNG_FILTER_AVG) ? "AVG " : "", + (filterSet & PNG_FILTER_PAETH) ? "PAETH " : ""); +} + + + +static void +doFilters(struct cmdlineInfo const cmdline, + struct pngx * const pngxP) { + + if (cmdline.filterSetSpec) { + if (verbose) + reportFilterSet(cmdline.filterSet); + pngx_setFilter(pngxP, cmdline.filterSet); + } +} + + + +static void reportTrans(struct pngx * const pngxP) { if (pngx_chunkIsPresent(pngxP, PNG_INFO_tRNS)) { @@ -2864,8 +2897,7 @@ convertpnm(struct cmdlineInfo const cmdline, doTimeChunk(cmdline, pngxP); - if (cmdline.filterSet != 0) - pngx_setFilter(pngxP, cmdline.filterSet); + doFilters(cmdline, pngxP); setZlibCompression(pngxP, cmdline.zlibCompression); diff --git a/doc/HISTORY b/doc/HISTORY index 6948e393..0cc8a44e 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -4,9 +4,23 @@ Netpbm. CHANGE HISTORY -------------- +19.05.04 BJH Release 10.86.03 + + pnmtopng: Fix bug: Defaults to no filters. Should be all + filters. Effect is larger PNG output. Broken after Netpbm + 10.26 (January 2005) but no later than Netpbm 10.35 (August + 2006). + + pnmtopng: Fix bug: Doesn't allow multiple filter options. + Broken after Netpbm 10.26 (January 2005) but no later than + Netpbm 10.35 (August 2006). + + pnmcrop: Don't allow -borderfile with -reportXXX. It doesn't + work. + 19.04.10 BJH Release 10.86.02 - pnmcrop: fix bug: -bgcolor never works. Always present + pnmcrop: fix bug: -bgcolor doesn't work. Always present (-bgcolor was introduced in Netpbm 10.86 (March 2019)). 19.04.06 BJH Release 10.86.01 diff --git a/editor/pnmcrop.c b/editor/pnmcrop.c index dba40c95..d6bae1d3 100644 --- a/editor/pnmcrop.c +++ b/editor/pnmcrop.c @@ -162,6 +162,10 @@ parseCommandLine(int argc, const char ** argv, if (reportFullOpt && reportSizeOpt) pm_error("You cannot specify both -reportfull and -reportsize"); + if ((reportFullOpt || reportSizeOpt) && borderfileSpec) + pm_error("You cannot specify -reportfull or -reportsize " + "with -borderfile"); + if (reportFullOpt) cmdlineP->baseOperation = OP_REPORT_FULL; else if (reportSizeOpt) diff --git a/version.mk b/version.mk index d14438e3..2d39bc86 100644 --- a/version.mk +++ b/version.mk @@ -1,3 +1,3 @@ NETPBM_MAJOR_RELEASE = 10 NETPBM_MINOR_RELEASE = 86 -NETPBM_POINT_RELEASE = 2 +NETPBM_POINT_RELEASE = 3 |