From f570e850753106b437802e3a49f14dfebd2ff91e Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sat, 4 May 2019 19:44:01 +0000 Subject: Release 10.73.27 git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@3603 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/other/pnmtopng.c | 71 +++++++++++++++++++++++++++++++++------------- doc/HISTORY | 11 +++++++ version.mk | 2 +- 3 files changed, 64 insertions(+), 20 deletions(-) diff --git a/converter/other/pnmtopng.c b/converter/other/pnmtopng.c index ce723d40..3899a9d2 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,26 @@ 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); @@ -2500,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) { @@ -2865,8 +2899,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 f5c9ed0e..477b4ef3 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -4,6 +4,17 @@ Netpbm. CHANGE HISTORY -------------- +19.05.04 BJH Release 10.73.27 + + 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). + 19.03.10 BJH Release 10.73.26 pstopnm: Fix bug: -textalphabits has no effect. Always broken. diff --git a/version.mk b/version.mk index 74f51870..04509eab 100644 --- a/version.mk +++ b/version.mk @@ -1,3 +1,3 @@ NETPBM_MAJOR_RELEASE = 10 NETPBM_MINOR_RELEASE = 73 -NETPBM_POINT_RELEASE = 26 +NETPBM_POINT_RELEASE = 27 -- cgit 1.4.1