about summary refs log tree commit diff
path: root/editor
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2012-12-05 16:52:32 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2012-12-05 16:52:32 +0000
commit8944b8ce855909a699c07068f712c127ee91cab2 (patch)
treeedb95f876a9c59ae33fbea370d6fda5a0e2f8aa6 /editor
parent5974339a3ea63d086f8fba466dfc83c42a600cd9 (diff)
downloadnetpbm-mirror-8944b8ce855909a699c07068f712c127ee91cab2.tar.gz
netpbm-mirror-8944b8ce855909a699c07068f712c127ee91cab2.tar.xz
netpbm-mirror-8944b8ce855909a699c07068f712c127ee91cab2.zip
Release 10.35.87
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@1802 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor')
-rw-r--r--editor/pnmmontage.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/editor/pnmmontage.c b/editor/pnmmontage.c
index 9eb2d7be..8916d251 100644
--- a/editor/pnmmontage.c
+++ b/editor/pnmmontage.c
@@ -207,6 +207,21 @@ adjustMaxval(tuple *            const tuplerow,
 
 
 static void
+makeRowBlack(struct pam * const pamP,
+             tuple *      const tuplerow) {
+
+    unsigned int col;
+
+    for (col = 0; col < pamP->width; ++col) {
+        unsigned int plane;
+        for (plane = 0; plane < pamP->depth; ++plane)
+            tuplerow[col][plane] = 0;
+    }
+}
+
+
+
+static void
 writePam(struct pam *       const outpamP,
          unsigned int       const nfiles,
          const coord *      const coords,
@@ -221,6 +236,9 @@ writePam(struct pam *       const outpamP,
 
     for (i = 0; i < outpamP->height; ++i) {
         int j;
+
+        makeRowBlack(outpamP, tuplerow);  /* initial value */
+
         for (j = 0; j < nfiles; ++j) {
             if (coords[j].y <= i && i < coords[j].y + imgs[j].height) {
                 pnm_readpamrow(&imgs[j], &tuplerow[coords[j].x]);
@@ -378,11 +396,10 @@ main(int argc, char **argv)
   }
 
   outimg.size = sizeof(outimg);
-  outimg.len = sizeof(outimg);
+  outimg.len = PAM_STRUCT_SIZE(allocation_depth);
+  pnm_setminallocationdepth(&outimg, outimg.depth);
+  outimg.plainformat = false;
   outimg.file = stdout;
-  outimg.bytes_per_sample = 0;
-  for (i = outimg.maxval; i; i >>= 8)
-    ++outimg.bytes_per_sample;
 
   writePam(&outimg, nfiles, coords, imgs);