Index: /branches/eam_rel9_b1/psLib/src/imageops/psImageStructManip.c
===================================================================
--- /branches/eam_rel9_b1/psLib/src/imageops/psImageStructManip.c	(revision 6372)
+++ /branches/eam_rel9_b1/psLib/src/imageops/psImageStructManip.c	(revision 6373)
@@ -8,6 +8,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-12-05 21:05:20 $
+ *  @version $Revision: 1.7.6.1 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-02-08 05:42:30 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -33,5 +33,5 @@
     psS32 inputColOffset;       // offset in bytes to first subset pixel in input row
 
-    if ( col0 < 0 || row0 < 0 ) {
+    if ( col0 < image->col0 || row0 < image->row0 ) {
         //        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
         //                PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID);
@@ -56,16 +56,17 @@
 
     if (col1 < 1) {
-        col1 = image->numCols + col1;
+        col1 = image->col0 + image->numCols + col1;
     }
     if (row1 < 1) {
-        row1 = image->numRows + row1;
-    }
-
+        row1 = image->row0 + image->numRows + row1;
+    }
+
+    // XXX should we be allowed to request a zero-sized image?
     if (    col1 <= col0 ||
             row1 <= row0 ||
-            col0 >= image->numCols ||
-            row0 >= image->numRows ||
-            col1 > image->numCols ||
-            row1 > image->numRows ) {
+            col0 >= image->col0 + image->numCols ||
+            row0 >= image->row0 + image->numRows ||
+            col1 > image->col0 + image->numCols ||
+            row1 > image->row0 + image->numRows ) {
         psError(PS_ERR_BAD_PARAMETER_VALUE, true,
                 PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID,
@@ -83,8 +84,9 @@
 
     if (image->parent != NULL) { // if this is a child, we need to start working with parent.
-        col0 += image->col0;
-        col1 += image->col0;
-        row0 += image->row0;
-        row1 += image->row0;
+        // XXX EAM : we now treat the region as parent coordinates
+        // col0 += image->col0;
+        // col1 += image->col0;
+        // row0 += image->row0;
+        // row1 += image->row0;
         image = (psImage*)image->parent;
     }
