about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Makefile.version2
-rw-r--r--converter/other/pnmtopng.c2
-rw-r--r--doc/HISTORY12
-rw-r--r--editor/pnmrotate.c24
-rw-r--r--generator/pbmtext.c2
-rw-r--r--lib/libpnm3.c24
-rw-r--r--lib/pnm.h3
-rw-r--r--other/pamx/image.c2
-rw-r--r--other/pamx/pamx.c2
9 files changed, 62 insertions, 11 deletions
diff --git a/Makefile.version b/Makefile.version
index 2260378d..f94dfe43 100644
--- a/Makefile.version
+++ b/Makefile.version
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 35
-NETPBM_POINT_RELEASE = 18
+NETPBM_POINT_RELEASE = 19
diff --git a/converter/other/pnmtopng.c b/converter/other/pnmtopng.c
index 9287d0ee..ed245b93 100644
--- a/converter/other/pnmtopng.c
+++ b/converter/other/pnmtopng.c
@@ -999,7 +999,7 @@ analyzeAlpha(FILE *     const ifp,
             for (col = 0; col < cols && !foundTransparentPixel; ++col) {
                 if (alphaMask[row][col] == 0) {
                     foundTransparentPixel = TRUE;
-                    transcolor = xeltopixel(xelrow[col]);
+                    transcolor = pnm_xeltopixel(xelrow[col], format);
                 }
             }
         }
diff --git a/doc/HISTORY b/doc/HISTORY
index 55f1055e..e8504162 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,18 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+06.12.03 BJH  Release 10.35.19
+
+              pbmtext: Fix crash when there is only one character.
+
+              pnmtopng: fix transparency optimization on PPM input.
+    
+              pnmrotate: fix -background option with PGM/PBM input.
+
+              pamx: fix bug with X depth = 0.
+
+              pamx: fix bug: incorrect display of one-plane input image.
+
 06.11.27 BJH  Release 10.35.18
 
               Configure: Fix incorrect .dylib suffix in shared library default.
diff --git a/editor/pnmrotate.c b/editor/pnmrotate.c
index 64c69e2a..ba817c17 100644
--- a/editor/pnmrotate.c
+++ b/editor/pnmrotate.c
@@ -159,6 +159,27 @@ computeNewFormat(bool     const antialias,
 
 
 
+static bool
+isWhite(xel    const color,
+        xelval const maxval) {
+
+    return (PPM_GETR(color) == maxval &&
+            PPM_GETG(color) == maxval &&
+            PPM_GETB(color) == maxval);
+}
+
+
+
+static bool
+isBlack(xel const color) {
+
+    return (PPM_GETR(color) == 0 &&
+            PPM_GETG(color) == 0 &&
+            PPM_GETB(color) == 0);
+}
+
+
+
 static xel
 backgroundColor(const char * const backgroundColorName,
                 xel *        const topRow,
@@ -180,8 +201,7 @@ backgroundColor(const char * const backgroundColorName,
 
             break;
         case PBM_TYPE:
-            if (!PNM_EQUAL(retval, pnm_whitexel(maxval, format)) &&
-                !PNM_EQUAL(retval, pnm_blackxel(maxval, format)))
+            if (!isWhite(retval, maxval) && !isBlack(retval))
                 pm_error("Image is PBM (black and white), "
                          "but you specified '%s', which is neither black "
                          "nor white, as background color", 
diff --git a/generator/pbmtext.c b/generator/pbmtext.c
index e1d132d0..6706598f 100644
--- a/generator/pbmtext.c
+++ b/generator/pbmtext.c
@@ -246,8 +246,8 @@ get_line_dimensions(const char line[], const struct font * const font_p,
                     *bwid_p += full_pixels;
                     accumulated_ics -= full_pixels;
                 }
-                lastGlyphP = glyphP;
             }
+            lastGlyphP = glyphP;
             *bwid_p += glyphP->xadd;
         }
     }
diff --git a/lib/libpnm3.c b/lib/libpnm3.c
index c9c9a1b0..f10a7fca 100644
--- a/lib/libpnm3.c
+++ b/lib/libpnm3.c
@@ -383,11 +383,29 @@ pnm_promoteformatrow( xelrow, cols, maxval, format, newmaxval, newformat )
 
 
 pixel
-xeltopixel(xel const inputxel) {
+pnm_xeltopixel(xel const inputxel,
+               int const format) {
     
     pixel outputpixel;
 
-    PPM_ASSIGN(outputpixel, 
-               PNM_GET1(inputxel), PNM_GET1(inputxel), PNM_GET1(inputxel));
+    switch (PNM_FORMAT_TYPE(format)) {
+    case PPM_TYPE:
+        PPM_ASSIGN(outputpixel,
+                   PPM_GETR(inputxel),
+                   PPM_GETG(inputxel),
+                   PPM_GETB(inputxel));
+        break;
+    case PGM_TYPE:
+    case PBM_TYPE:
+        PPM_ASSIGN(outputpixel,
+                   PNM_GET1(inputxel),
+                   PNM_GET1(inputxel),
+                   PNM_GET1(inputxel));
+        break;
+    default:
+        pm_error("Invalid format code %d passed to pnm_xeltopixel()",
+                 format);
+    }
+
     return outputpixel;
 }
diff --git a/lib/pnm.h b/lib/pnm.h
index d3b6f84f..ed6983f4 100644
--- a/lib/pnm.h
+++ b/lib/pnm.h
@@ -124,7 +124,8 @@ pnm_promoteformatrow(xel* xelrow, int cols, xelval maxval, int format,
                      xelval newmaxval, int newformat);
 
 pixel
-xeltopixel(xel const inputxel);
+pnm_xeltopixel(xel const inputxel,
+               int const format);
 
 #ifdef __cplusplus
 }
diff --git a/other/pamx/image.c b/other/pamx/image.c
index 3aaa8478..892a9768 100644
--- a/other/pamx/image.c
+++ b/other/pamx/image.c
@@ -157,7 +157,7 @@ newRGBImage(unsigned int const width,
             unsigned int const height,
             unsigned int const depth) {
     
-    unsigned int const pixlen = pixlen > 0 ? (depth + 7) / 8 : 1;
+    unsigned int const pixlen = depth > 0 ? (depth + 7) / 8 : 1;
         /* Special case for "zero" depth image, which is sometimes
            interpreted as "one color"
         */
diff --git a/other/pamx/pamx.c b/other/pamx/pamx.c
index 8a64fec4..17980643 100644
--- a/other/pamx/pamx.c
+++ b/other/pamx/pamx.c
@@ -184,7 +184,7 @@ fillRow1(struct pam *     const pamP,
     
     for (col = 0; col < pamP->width; ++col) {
         unsigned int plane;
-        for (plane = 0; plane < pamP->depth; ++plane)
+        for (plane = 0; plane < 3; ++plane)
             *(*pP)++ =
                 pnm_scalesample(tuplerow[col][0], pamP->maxval, 255);
     }