about summary refs log tree commit diff
path: root/editor
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2008-08-29 19:47:32 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2008-08-29 19:47:32 +0000
commit37f38cafb6719d3bde8c487a597400a81d733aba (patch)
tree341b54f186747d0b39d6ac5015c66bc929eecde2 /editor
parentfbedc8c762da4ad527b4bd695473606b4b38d412 (diff)
downloadnetpbm-mirror-37f38cafb6719d3bde8c487a597400a81d733aba.tar.gz
netpbm-mirror-37f38cafb6719d3bde8c487a597400a81d733aba.tar.xz
netpbm-mirror-37f38cafb6719d3bde8c487a597400a81d733aba.zip
Release 10.35.50
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@718 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor')
-rw-r--r--editor/pamcomp.c42
-rw-r--r--editor/pamcut.c12
2 files changed, 53 insertions, 1 deletions
diff --git a/editor/pamcomp.c b/editor/pamcomp.c
index f7346483..fd3147a2 100644
--- a/editor/pamcomp.c
+++ b/editor/pamcomp.c
@@ -306,6 +306,44 @@ warnOutOfFrame( int const originLeft,
 
 
 static void
+validateComputableHeight(int const originTop, 
+                         int const overRows) {
+
+    if (originTop < 0) {
+        if (originTop < -INT_MAX)
+            pm_error("Overlay starts too far above the underlay image to be "
+                     "computable.  Overlay can be at most %d rows above "
+                     "the underlay.", INT_MAX);
+    } else {
+        if (INT_MAX - originTop <= overRows)
+            pm_error("Too many total rows involved to be computable.  "
+                     "You must have a shorter overlay image or compose it "
+                     "higher on the underlay image.");
+    }
+}
+
+
+
+static void
+validateComputableHeight(int const originTop, 
+                         int const overRows) {
+
+    if (originTop < 0) {
+        if (originTop < -INT_MAX)
+            pm_error("Overlay starts too far above the underlay image to be "
+                     "computable.  Overlay can be at most %d rows above "
+                     "the underlay.", INT_MAX);
+    } else {
+        if (INT_MAX - originTop <= overRows)
+            pm_error("Too many total rows involved to be computable.  "
+                     "You must have a shorter overlay image or compose it "
+                     "higher on the underlay image.");
+    }
+}
+
+
+
+static void
 computeOverlayPosition(int                const underCols, 
                        int                const underRows,
                        int                const overCols, 
@@ -340,6 +378,10 @@ computeOverlayPosition(int                const underCols,
     *originLeftP = xalign + cmdline.xoff;
     *originTopP  = yalign + cmdline.yoff;
 
+    validateComputableHeight(*originTopP, overRows);
+
+    validateComputableHeight(*originTopP, overRows);
+
     warnOutOfFrame(*originLeftP, *originTopP, 
                    overCols, overRows, underCols, underRows);    
 }
diff --git a/editor/pamcut.c b/editor/pamcut.c
index 7d95fa0a..c5d53f44 100644
--- a/editor/pamcut.c
+++ b/editor/pamcut.c
@@ -504,7 +504,17 @@ cutOneImage(FILE *             const ifP,
     if (!cmdline.pad)
         rejectOutOfBounds(inpam.width, inpam.height, leftcol, rightcol, 
                           toprow, bottomrow);
-
+    else {
+        if (cmdline.left > cmdline.right) 
+            pm_error("You have specified a left edge (%d) that is to the right\n"
+                     "of the right edge you specified (%d)", 
+                     cmdline.left, cmdline.right);
+        
+        if (cmdline.top > cmdline.bottom) 
+            pm_error("You have specified a top edge (%d) that is below\n"
+                     "the bottom edge you specified (%d)", 
+                     cmdline.top, cmdline.bottom);
+    }
     if (cmdline.verbose) {
         pm_message("Image goes from Row 0, Column 0 through Row %d, Column %d",
                    inpam.height-1, inpam.width-1);