Index: /branches/czw_branch/20120906/psLib/src/imageops/psImagePixelManip.c
===================================================================
--- /branches/czw_branch/20120906/psLib/src/imageops/psImagePixelManip.c	(revision 34452)
+++ /branches/czw_branch/20120906/psLib/src/imageops/psImagePixelManip.c	(revision 34453)
@@ -216,17 +216,35 @@
     }
 
-
+#define psImageOverlayLoopClean(DATATYPE,OP) {	 \
+      for (int row=y0;row<imageRowLimit;row++) {	    \
+	ps##DATATYPE* imageRow = image->data.DATATYPE[row];	   \
+	ps##DATATYPE* overlayRow = overlay->data.DATATYPE[row-y0]; \
+	for (int col=x0;col<imageColLimit;col++) {		   \
+	  if (!isfinite(imageRow[col])) {			   \
+	    imageRow[col] OP overlayRow[col-x0];		   \
+	  }							   \
+	  else if (!isfinite(overlayRow[col-x0])) {		   \
+	    imageRow[col] = imageRow[col];			   \
+	  }							   \
+	  else {						   \
+	    imageRow[col] = overlayRow[col-x0];			   \
+	  }								\
+	}								\
+      }									\
+      pixelsOverlaid += (imageRowLimit - y0) * (imageColLimit - x0);	\
+    }
+	
+    
+    
     #define psImageOverlayLoop(DATATYPE,OP) { \
         for (int row=y0;row<imageRowLimit;row++) { \
             ps##DATATYPE* imageRow = image->data.DATATYPE[row]; \
             ps##DATATYPE* overlayRow = overlay->data.DATATYPE[row-y0]; \
-            for (int col=x0;col<imageColLimit;col++) { \
-	      if (isfinite(overlayRow[col - x0])) { \
-                imageRow[col] OP overlayRow[col-x0]; \
-	      } \
-            } \
-        } \
+            for (int col=x0;col<imageColLimit;col++) {		       \
+                imageRow[col] OP overlayRow[col-x0];		       \
+	      }							       \
+        }							       \
         pixelsOverlaid += (imageRowLimit - y0) * (imageColLimit - x0); \
-    }
+      }
 
     #define psImageOverlayLoopDivide(DATATYPE,BADVALUE) { \
@@ -250,5 +268,5 @@
     // a drawback?  We fall back on the loop if we have to change types.
     #define psImageOverlaySetLoop(DATATYPE) { \
-      if (0) { \
+        if (image->type.type == overlay->type.type) { \
             int numBytes = (imageColLimit - x0) * sizeof(ps##DATATYPE); \
             for (int row = y0; row < imageRowLimit; row++) { \
@@ -275,4 +293,7 @@
         psImageOverlayLoop(DATATYPE,*=); \
         break; \
+    case 'E': \
+      psImageOverlayLoopClean(DATATYPE,=); \
+      break;			       \
     case '/': \
         psImageOverlayLoopDivide(DATATYPE,BADVALUE); \
