about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/HISTORY6
-rw-r--r--other/pamx/window.c22
2 files changed, 26 insertions, 2 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index 1225522e..0dcbd5af 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -9,7 +9,11 @@ not yet  BJH  Release 10.98.00
               pnmtosir: Set some possibly meaningless bits in output to zero
               so output is repeatable.
 
-              pnmtorle: fix bug: -h works only on first image.
+              pamx: Fix bug: top-justifies image in all cases where it should
+              bottom-justify.  Always broken.  (pamx was new in Netpbm 10.34
+              (June 2006).
+
+              pnmtorle: Fix bug: -h works only on first image.
 
               pamsistoaglyph: Fix invalid memory reference and incorrect
               output on depth 1 input.  Always broken.  (pamsistoaglyph was
diff --git a/other/pamx/window.c b/other/pamx/window.c
index eef37449..61089ea5 100644
--- a/other/pamx/window.c
+++ b/other/pamx/window.c
@@ -348,7 +348,27 @@ placeImage(viewer * const viewerP,
            int      const height,
            int *    const rxP,     /* input and output */
            int *    const ryP) {   /* input and output */
+/*----------------------------------------------------------------------------
+   Move the X window of *viewerP on the right place on the display to contain
+   an image whose dimensions are 'width' by 'height'.
+
+   As input *rxP and *ryP are the current location of the window (offset from
+   the top left corner of the display of the top left corner of the window).
+   We update them with the new location.
+
+   If the image is narrower than the display, center it.
+
+   Otherwise, either left-justify it or right-justify it depending upon the
+   current position of the window:
 
+      If in the current position, the right edge of the image is within the
+      display, right-justify.
+
+      Otherwise left-justify.
+
+
+   Do the analogous thing for vertical placement.
+-----------------------------------------------------------------------------*/
     int pixx, pixy;
 
     pixx = *rxP;
@@ -366,7 +386,7 @@ placeImage(viewer * const viewerP,
         pixy = (viewerP->height - height) / 2;
     else {
         if ((pixy < 0) && (pixy + height < viewerP->height))
-            pixy = viewerP->height - viewerP->height;
+            pixy = viewerP->height - height;
         if (pixy > 0)
             pixy = 0;
     }