diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-12-16 19:17:41 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-12-16 19:17:41 +0000 |
commit | 7438b0c5863e849662cf00c7709731d27409e195 (patch) | |
tree | 1894086fe2dfb2457d30742a44909678f0de97d1 | |
parent | e93b99570398f2b27058eb38e47c8ef57e74bd0d (diff) | |
download | netpbm-mirror-7438b0c5863e849662cf00c7709731d27409e195.tar.gz netpbm-mirror-7438b0c5863e849662cf00c7709731d27409e195.tar.xz netpbm-mirror-7438b0c5863e849662cf00c7709731d27409e195.zip |
Fix incorrect padding color in recent development
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4805 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r-- | editor/pnmpad.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/editor/pnmpad.c b/editor/pnmpad.c index ae1abc1f..94ea0ed1 100644 --- a/editor/pnmpad.c +++ b/editor/pnmpad.c @@ -855,14 +855,25 @@ regressColor(int const format, xel retval; - if (format == PBM_TYPE) { + switch (PNM_FORMAT_TYPE(format)) { + case PBM_TYPE: + { gray const threshold = maxval / 2; retval = grayval > threshold ? pnm_whitexel(maxval, format) : pnm_blackxel(maxval, format); - } else { /* PGM_TYPE */ + } + break; + case PGM_TYPE: retval.b = grayval; retval.r = retval.g = 0; + break; + case PPM_TYPE: + retval = color; + break; + default: + pm_error("internal error -- impossible value of PNM format " + "type in regressColor"); } return retval; } |