Index: trunk/psLib/src/imageops/psImagePixelManip.c
===================================================================
--- trunk/psLib/src/imageops/psImagePixelManip.c	(revision 7112)
+++ trunk/psLib/src/imageops/psImagePixelManip.c	(revision 7123)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-05-13 02:35:02 $
+ *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-05-16 03:27:13 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -260,13 +260,17 @@
     // faster than using a 'for' loop.  Josh Hoblitt says it has an additional advantage that it doesn't blow
     // away the L2 cache.  Of course, if you want to use the result immediately afterwards, perhaps this is
-    // a drawback?
+    // a drawback?  We fall back on the loop if we have to change types.
     #define psImageOverlaySetLoop(DATATYPE) { \
-        int numBytes = (imageColLimit - x0) * sizeof(ps##DATATYPE); \
-        for (int row = y0; row < imageRowLimit; row++) { \
-            ps##DATATYPE *imageRow = image->data.DATATYPE[row]; \
-            ps##DATATYPE *overlayRow = overlay->data.DATATYPE[row - y0]; \
-            memcpy(&imageRow[x0], overlayRow, numBytes); \
-        } \
-        pixelsOverlaid += (imageRowLimit - y0) * (imageColLimit - x0); \
+        if (image->type.type == overlay->type.type) { \
+            int numBytes = (imageColLimit - x0) * sizeof(ps##DATATYPE); \
+            for (int row = y0; row < imageRowLimit; row++) { \
+                ps##DATATYPE *imageRow = image->data.DATATYPE[row]; \
+                ps##DATATYPE *overlayRow = overlay->data.DATATYPE[row - y0]; \
+                memcpy(&imageRow[x0], overlayRow, numBytes); \
+            } \
+            pixelsOverlaid += (imageRowLimit - y0) * (imageColLimit - x0); \
+        } else { \
+            psImageOverlayLoop(DATATYPE,=); \
+        } \
     }
 
