about summary refs log tree commit diff
path: root/converter/other
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2007-10-13 00:50:12 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2007-10-13 00:50:12 +0000
commite1c980c7e19738902347ecf87b71703d9fb2571b (patch)
tree538dab0c360acd5bbcd46a71f34d9fd020507929 /converter/other
parentc5b69ed7dadf8de4b1d19cc7617172a0390c1586 (diff)
downloadnetpbm-mirror-e1c980c7e19738902347ecf87b71703d9fb2571b.tar.gz
netpbm-mirror-e1c980c7e19738902347ecf87b71703d9fb2571b.tar.xz
netpbm-mirror-e1c980c7e19738902347ecf87b71703d9fb2571b.zip
Release 10.35.32
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@437 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other')
-rw-r--r--converter/other/bmptopnm.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/converter/other/bmptopnm.c b/converter/other/bmptopnm.c
index 3ba1d77c..4d29e4d3 100644
--- a/converter/other/bmptopnm.c
+++ b/converter/other/bmptopnm.c
@@ -651,11 +651,15 @@ extractBitFields(unsigned int       const rasterval,
     unsigned int const abits = 
         (rasterval >> pixelformat.trn.shift) & pixelformat.trn.mask;
     
-    *rP = (unsigned int) rbits * maxval / pixelformat.red.mask;
-    *gP = (unsigned int) gbits * maxval / pixelformat.blu.mask;
-    *bP = (unsigned int) bbits * maxval / pixelformat.grn.mask;
-    *aP = (unsigned int) abits * maxval / pixelformat.trn.mask;
-}        
+    *rP = pixelformat.red.mask ?
+              (unsigned int) rbits * maxval / pixelformat.red.mask : 0;
+    *gP = pixelformat.grn.mask ?
+              (unsigned int) gbits * maxval / pixelformat.grn.mask : 0;
+    *bP = pixelformat.blu.mask ?
+              (unsigned int) bbits * maxval / pixelformat.blu.mask : 0;
+    *aP = pixelformat.trn.mask ?
+              (unsigned int) abits * maxval / pixelformat.trn.mask : 0;
+}