diff src/video/SDL_RLEaccel.c @ 1:cf2af46e9e2a

Changes since SDL 1.2.0 release
author Sam Lantinga <slouken@lokigames.com>
date Thu, 26 Apr 2001 16:50:19 +0000
parents 74212992fb08
children e8157fcb3114
line wrap: on
line diff
--- a/src/video/SDL_RLEaccel.c	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/video/SDL_RLEaccel.c	Thu Apr 26 16:50:19 2001 +0000
@@ -109,12 +109,21 @@
 #define MIN(a, b) ((a) < (b) ? (a) : (b))
 #endif
 
+#define PIXEL_COPY(to, from, len, bpp)			\
+do {							\
+    if(bpp == 4) {					\
+	SDL_memcpy4(to, from, (unsigned)(len));		\
+    } else {						\
+	SDL_memcpy(to, from, (unsigned)(len) * (bpp));	\
+    }							\
+} while(0)
+
 /*
  * Various colorkey blit methods, for opaque and per-surface alpha
  */
 
 #define OPAQUE_BLIT(to, from, length, bpp, alpha)	\
-    SDL_memcpy(to, from, (unsigned)(length * bpp))
+    PIXEL_COPY(to, from, length, bpp)
 
 /*
  * For 32bpp pixels on the form 0x00rrggbb:
@@ -657,9 +666,9 @@
 		    if(crun > right - cofs)				  \
 			crun = right - cofs;				  \
 		    if(crun > 0)					  \
-			SDL_memcpy(dstbuf + cofs * sizeof(Ptype),	  \
+			PIXEL_COPY(dstbuf + cofs * sizeof(Ptype),	  \
 				   srcbuf + (cofs - ofs) * sizeof(Ptype), \
-				   (unsigned)crun * sizeof(Ptype));	  \
+				   (unsigned)crun, sizeof(Ptype));	  \
 		    srcbuf += run * sizeof(Ptype);			  \
 		    ofs += run;						  \
 		} else if(!ofs)						  \
@@ -816,8 +825,8 @@
 		    run = ((Ctype *)srcbuf)[1];				 \
 		    srcbuf += 2 * sizeof(Ctype);			 \
 		    if(run) {						 \
-			SDL_memcpy(dstbuf + ofs * sizeof(Ptype), srcbuf, \
-				   run * sizeof(Ptype));		 \
+			PIXEL_COPY(dstbuf + ofs * sizeof(Ptype), srcbuf, \
+				   run, sizeof(Ptype));			 \
 			srcbuf += run * sizeof(Ptype);			 \
 			ofs += run;					 \
 		    } else if(!ofs)					 \