about summary refs log tree commit diff
path: root/editor/pamcomp.c
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/pamcomp.c
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/pamcomp.c')
-rw-r--r--editor/pamcomp.c42
1 files changed, 42 insertions, 0 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);    
 }