Index: trunk/psLib/src/imageops/psImagePixelManip.c
===================================================================
--- trunk/psLib/src/imageops/psImagePixelManip.c	(revision 6227)
+++ trunk/psLib/src/imageops/psImagePixelManip.c	(revision 7112)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-01-28 01:12:11 $
+ *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-05-13 02:35:02 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -253,4 +253,18 @@
                 imageRow[col] OP overlayRow[col-x0]; \
             } \
+        } \
+        pixelsOverlaid += (imageRowLimit - y0) * (imageColLimit - x0); \
+    }
+
+    // Use memcpy to perform the '=' operation.  Depending on the particular application, it can be about 20%
+    // 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?
+    #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); \
@@ -273,5 +287,5 @@
         break; \
     case '=': \
-        psImageOverlayLoop(DATATYPE,=); \
+        psImageOverlaySetLoop(DATATYPE); \
         break; \
     default: \
