src/video/SDL_blit.h
author Sam Lantinga
Sun, 06 Mar 2011 21:12:19 -0800
changeset 5423 b69fa50e80d7
parent 5389 24903690f48a
child 5426 7a3982c50af8
permissions -rw-r--r--
a Nintendo ds update

Frank Zago to SDL

For those interested, here's a snapshot of the current port. I did away with
most of the previous attempt which was based of the sprite engine, because the
support is limited to 128 64x64 sprites. Instead I'm using the gl engine.
The drawback is that either the frame buffer or the gl engine can be used
because there's not that much video memory on a DS.

With minimal changes to their code, it can now run the following tests: ,
testspriteminimal, testscale and testsprite2. The last 2 only run under the
emulator for some reason. The tests are not included in this patch for size
reason.

In 16 bits mode, the 16th bit indicated transparency/opacity. If 0, the color
is not displayed. So I had to patch a few core file to set that bit to 1. See
patch for src/video/SDL_RLEaccel.c and src/video/SDL_blit.h. Is that ok, or is
there a better way ?

The nds also doesn't support windowed mode, so I force the fullscreen in
src/video/SDL_video.c. Is that ok, or is there a better way ?

To get a smaller library, I also tried to not compile the software renderer
when the hardware renderer is compiled in, and define SDL_NO_COMPAT; however
the compilation eventually fails in SDL_surface.c because SDL_SRCCOLORKEY is
defined in SDL_compat.h. Is SDL_NO_COMPAT only for application and not SDL
itself ?
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2011 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 #include "SDL_config.h"
    23 
    24 #ifndef _SDL_blit_h
    25 #define _SDL_blit_h
    26 
    27 #include "SDL_cpuinfo.h"
    28 #include "SDL_endian.h"
    29 #include "SDL_surface.h"
    30 
    31 /* SDL blit copy flags */
    32 #define SDL_COPY_MODULATE_COLOR     0x00000001
    33 #define SDL_COPY_MODULATE_ALPHA     0x00000002
    34 #define SDL_COPY_BLEND              0x00000010
    35 #define SDL_COPY_ADD                0x00000020
    36 #define SDL_COPY_MOD                0x00000040
    37 #define SDL_COPY_COLORKEY           0x00000100
    38 #define SDL_COPY_NEAREST            0x00000200
    39 #define SDL_COPY_RLE_DESIRED        0x00001000
    40 #define SDL_COPY_RLE_COLORKEY       0x00002000
    41 #define SDL_COPY_RLE_ALPHAKEY       0x00004000
    42 #define SDL_COPY_RLE_MASK           (SDL_COPY_RLE_DESIRED|SDL_COPY_RLE_COLORKEY|SDL_COPY_RLE_ALPHAKEY)
    43 
    44 /* SDL blit CPU flags */
    45 #define SDL_CPU_ANY                 0x00000000
    46 #define SDL_CPU_MMX                 0x00000001
    47 #define SDL_CPU_3DNOW               0x00000002
    48 #define SDL_CPU_SSE                 0x00000004
    49 #define SDL_CPU_SSE2                0x00000008
    50 #define SDL_CPU_ALTIVEC_PREFETCH    0x00000010
    51 #define SDL_CPU_ALTIVEC_NOPREFETCH  0x00000020
    52 
    53 typedef struct
    54 {
    55     Uint8 *src;
    56     int src_w, src_h;
    57     int src_pitch;
    58     int src_skip;
    59     Uint8 *dst;
    60     int dst_w, dst_h;
    61     int dst_pitch;
    62     int dst_skip;
    63     SDL_PixelFormat *src_fmt;
    64     SDL_PixelFormat *dst_fmt;
    65     Uint8 *table;
    66     int flags;
    67     Uint32 colorkey;
    68     Uint8 r, g, b, a;
    69 } SDL_BlitInfo;
    70 
    71 typedef void (SDLCALL * SDL_BlitFunc) (SDL_BlitInfo * info);
    72 
    73 typedef struct
    74 {
    75     Uint32 src_format;
    76     Uint32 dst_format;
    77     int flags;
    78     int cpu;
    79     SDL_BlitFunc func;
    80 } SDL_BlitFuncEntry;
    81 
    82 /* Blit mapping definition */
    83 typedef struct SDL_BlitMap
    84 {
    85     SDL_Surface *dst;
    86     int identity;
    87     SDL_blit blit;
    88     void *data;
    89     SDL_BlitInfo info;
    90 
    91     /* the version count matches the destination; mismatch indicates
    92        an invalid mapping */
    93     Uint32 palette_version;
    94 } SDL_BlitMap;
    95 
    96 /* Functions found in SDL_blit.c */
    97 extern int SDL_CalculateBlit(SDL_Surface * surface);
    98 
    99 /* Functions found in SDL_blit_*.c */
   100 extern SDL_BlitFunc SDL_CalculateBlit0(SDL_Surface * surface);
   101 extern SDL_BlitFunc SDL_CalculateBlit1(SDL_Surface * surface);
   102 extern SDL_BlitFunc SDL_CalculateBlitN(SDL_Surface * surface);
   103 extern SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface * surface);
   104 
   105 /*
   106  * Useful macros for blitting routines
   107  */
   108 
   109 #if defined(__GNUC__)
   110 #define DECLARE_ALIGNED(t,v,a)  t __attribute__((aligned(a))) v
   111 #elif defined(_MSC_VER)
   112 #define DECLARE_ALIGNED(t,v,a)  __declspec(align(a)) t v
   113 #else
   114 #define DECLARE_ALIGNED(t,v,a)  t v
   115 #endif
   116 
   117 /* The Nintendo surfaces are special. Bit 15 is the transparency
   118  * bit. It must be set for the pixel to be displayed. By setting that
   119  * value to 0 for other platforms, their compiler should optimize it
   120  * out. */
   121 #ifdef __NDS__
   122 #define NDS_BIT15 0x8000
   123 #else
   124 #define NDS_BIT15 0
   125 #endif
   126 
   127 /* Load pixel of the specified format from a buffer and get its R-G-B values */
   128 /* FIXME: rescale values to 0..255 here? */
   129 #define RGB_FROM_PIXEL(Pixel, fmt, r, g, b)				\
   130 {									\
   131 	r = (((Pixel&fmt->Rmask)>>fmt->Rshift)<<fmt->Rloss); 		\
   132 	g = (((Pixel&fmt->Gmask)>>fmt->Gshift)<<fmt->Gloss); 		\
   133 	b = (((Pixel&fmt->Bmask)>>fmt->Bshift)<<fmt->Bloss); 		\
   134 }
   135 #define RGB_FROM_RGB565(Pixel, r, g, b)					\
   136 {									\
   137 	r = (((Pixel&0xF800)>>11)<<3);		 			\
   138 	g = (((Pixel&0x07E0)>>5)<<2); 					\
   139 	b = ((Pixel&0x001F)<<3); 					\
   140 }
   141 #define RGB_FROM_RGB555(Pixel, r, g, b)					\
   142 {									\
   143 	r = (((Pixel&0x7C00)>>10)<<3);		 			\
   144 	g = (((Pixel&0x03E0)>>5)<<3); 					\
   145 	b = ((Pixel&0x001F)<<3); 					\
   146 }
   147 #define RGB_FROM_RGB888(Pixel, r, g, b)					\
   148 {									\
   149 	r = ((Pixel&0xFF0000)>>16);		 			\
   150 	g = ((Pixel&0xFF00)>>8);		 			\
   151 	b = (Pixel&0xFF);			 			\
   152 }
   153 #define RETRIEVE_RGB_PIXEL(buf, bpp, Pixel)				   \
   154 do {									   \
   155 	switch (bpp) {							   \
   156 		case 2:							   \
   157 			Pixel = *((Uint16 *)(buf));			   \
   158 		break;							   \
   159 									   \
   160 		case 3: {						   \
   161 		        Uint8 *B = (Uint8 *)(buf);			   \
   162 			if (SDL_BYTEORDER == SDL_LIL_ENDIAN) {		   \
   163 			        Pixel = B[0] + (B[1] << 8) + (B[2] << 16); \
   164 			} else {					   \
   165 			        Pixel = (B[0] << 16) + (B[1] << 8) + B[2]; \
   166 			}						   \
   167 		}							   \
   168 		break;							   \
   169 									   \
   170 		case 4:							   \
   171 			Pixel = *((Uint32 *)(buf));			   \
   172 		break;							   \
   173 									   \
   174 		default:						   \
   175 		        Pixel; /* stop gcc complaints */		   \
   176 		break;							   \
   177 	}								   \
   178 } while (0)
   179 
   180 #define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b)			   \
   181 do {									   \
   182 	switch (bpp) {							   \
   183 		case 2:							   \
   184 			Pixel = *((Uint16 *)(buf));			   \
   185 			RGB_FROM_PIXEL(Pixel, fmt, r, g, b);		   \
   186 		break;							   \
   187 									   \
   188 		case 3:	{						   \
   189                         if (SDL_BYTEORDER == SDL_LIL_ENDIAN) {		   \
   190 			        r = *((buf)+fmt->Rshift/8);		   \
   191 				g = *((buf)+fmt->Gshift/8);		   \
   192 				b = *((buf)+fmt->Bshift/8);		   \
   193 			} else {					   \
   194 			        r = *((buf)+2-fmt->Rshift/8);		   \
   195 				g = *((buf)+2-fmt->Gshift/8);		   \
   196 				b = *((buf)+2-fmt->Bshift/8);		   \
   197 			}						   \
   198 		}							   \
   199 		break;							   \
   200 									   \
   201 		case 4:							   \
   202 			Pixel = *((Uint32 *)(buf));			   \
   203 			RGB_FROM_PIXEL(Pixel, fmt, r, g, b);		   \
   204 		break;							   \
   205 									   \
   206 		default:						   \
   207 		        Pixel; /* stop gcc complaints */		   \
   208 		break;							   \
   209 	}								   \
   210 } while (0)
   211 
   212 /* Assemble R-G-B values into a specified pixel format and store them */
   213 #define PIXEL_FROM_RGB(Pixel, fmt, r, g, b)				\
   214 {									\
   215 	Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)|				\
   216 		((g>>fmt->Gloss)<<fmt->Gshift)|				\
   217 		((b>>fmt->Bloss)<<fmt->Bshift);				\
   218 }
   219 #define RGB565_FROM_RGB(Pixel, r, g, b)					\
   220 {									\
   221 	Pixel = ((r>>3)<<11)|((g>>2)<<5)|(b>>3);			\
   222 }
   223 #define RGB555_FROM_RGB(Pixel, r, g, b)					\
   224 {									\
   225 	Pixel = ((r>>3)<<10)|((g>>3)<<5)|(b>>3);			\
   226 }
   227 #define RGB888_FROM_RGB(Pixel, r, g, b)					\
   228 {									\
   229 	Pixel = (r<<16)|(g<<8)|b;					\
   230 }
   231 #define ARGB8888_FROM_RGBA(Pixel, r, g, b, a)				\
   232 {									\
   233 	Pixel = (a<<24)|(r<<16)|(g<<8)|b;				\
   234 }
   235 #define RGBA8888_FROM_RGBA(Pixel, r, g, b, a)				\
   236 {									\
   237 	Pixel = (r<<24)|(g<<16)|(b<<8)|a;				\
   238 }
   239 #define ABGR8888_FROM_RGBA(Pixel, r, g, b, a)				\
   240 {									\
   241 	Pixel = (a<<24)|(b<<16)|(g<<8)|r;				\
   242 }
   243 #define BGRA8888_FROM_RGBA(Pixel, r, g, b, a)				\
   244 {									\
   245 	Pixel = (b<<24)|(g<<16)|(r<<8)|a;				\
   246 }
   247 #define ASSEMBLE_RGB(buf, bpp, fmt, r, g, b) 				\
   248 {									\
   249 	switch (bpp) {							\
   250 		case 2: {						\
   251 			Uint16 Pixel;					\
   252 									\
   253 			PIXEL_FROM_RGB(Pixel, fmt, r, g, b);		\
   254 			*((Uint16 *)(buf)) = Pixel | NDS_BIT15;		\
   255 		}							\
   256 		break;							\
   257 									\
   258 		case 3: {						\
   259                         if (SDL_BYTEORDER == SDL_LIL_ENDIAN) {		\
   260 			        *((buf)+fmt->Rshift/8) = r;		\
   261 				*((buf)+fmt->Gshift/8) = g;		\
   262 				*((buf)+fmt->Bshift/8) = b;		\
   263 			} else {					\
   264 			        *((buf)+2-fmt->Rshift/8) = r;		\
   265 				*((buf)+2-fmt->Gshift/8) = g;		\
   266 				*((buf)+2-fmt->Bshift/8) = b;		\
   267 			}						\
   268 		}							\
   269 		break;							\
   270 									\
   271 		case 4: {						\
   272 			Uint32 Pixel;					\
   273 									\
   274 			PIXEL_FROM_RGB(Pixel, fmt, r, g, b);		\
   275 			*((Uint32 *)(buf)) = Pixel;			\
   276 		}							\
   277 		break;							\
   278 	}								\
   279 }
   280 #define ASSEMBLE_RGB_AMASK(buf, bpp, fmt, r, g, b, Amask)		\
   281 {									\
   282 	switch (bpp) {							\
   283 		case 2: {						\
   284 			Uint16 *bufp;					\
   285 			Uint16 Pixel;					\
   286 									\
   287 			bufp = (Uint16 *)buf;				\
   288 			PIXEL_FROM_RGB(Pixel, fmt, r, g, b);		\
   289 			*bufp = Pixel | (*bufp & Amask);		\
   290 		}							\
   291 		break;							\
   292 									\
   293 		case 3: {						\
   294                         if (SDL_BYTEORDER == SDL_LIL_ENDIAN) {		\
   295 			        *((buf)+fmt->Rshift/8) = r;		\
   296 				*((buf)+fmt->Gshift/8) = g;		\
   297 				*((buf)+fmt->Bshift/8) = b;		\
   298 			} else {					\
   299 			        *((buf)+2-fmt->Rshift/8) = r;		\
   300 				*((buf)+2-fmt->Gshift/8) = g;		\
   301 				*((buf)+2-fmt->Bshift/8) = b;		\
   302 			}						\
   303 		}							\
   304 		break;							\
   305 									\
   306 		case 4: {						\
   307 			Uint32 *bufp;					\
   308 			Uint32 Pixel;					\
   309 									\
   310 			bufp = (Uint32 *)buf;				\
   311 			PIXEL_FROM_RGB(Pixel, fmt, r, g, b);		\
   312 			*bufp = Pixel | (*bufp & Amask);		\
   313 		}							\
   314 		break;							\
   315 	}								\
   316 }
   317 
   318 /* FIXME: Should we rescale alpha into 0..255 here? */
   319 #define RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a)				\
   320 {									\
   321 	r = ((Pixel&fmt->Rmask)>>fmt->Rshift)<<fmt->Rloss; 		\
   322 	g = ((Pixel&fmt->Gmask)>>fmt->Gshift)<<fmt->Gloss; 		\
   323 	b = ((Pixel&fmt->Bmask)>>fmt->Bshift)<<fmt->Bloss; 		\
   324 	a = ((Pixel&fmt->Amask)>>fmt->Ashift)<<fmt->Aloss;	 	\
   325 }
   326 #define RGBA_FROM_8888(Pixel, fmt, r, g, b, a)	\
   327 {						\
   328 	r = (Pixel&fmt->Rmask)>>fmt->Rshift;	\
   329 	g = (Pixel&fmt->Gmask)>>fmt->Gshift;	\
   330 	b = (Pixel&fmt->Bmask)>>fmt->Bshift;	\
   331 	a = (Pixel&fmt->Amask)>>fmt->Ashift;	\
   332 }
   333 #define RGBA_FROM_RGBA8888(Pixel, r, g, b, a)				\
   334 {									\
   335 	r = (Pixel>>24);						\
   336 	g = ((Pixel>>16)&0xFF);						\
   337 	b = ((Pixel>>8)&0xFF);						\
   338 	a = (Pixel&0xFF);						\
   339 }
   340 #define RGBA_FROM_ARGB8888(Pixel, r, g, b, a)				\
   341 {									\
   342 	r = ((Pixel>>16)&0xFF);						\
   343 	g = ((Pixel>>8)&0xFF);						\
   344 	b = (Pixel&0xFF);						\
   345 	a = (Pixel>>24);						\
   346 }
   347 #define RGBA_FROM_ABGR8888(Pixel, r, g, b, a)				\
   348 {									\
   349 	r = (Pixel&0xFF);						\
   350 	g = ((Pixel>>8)&0xFF);						\
   351 	b = ((Pixel>>16)&0xFF);						\
   352 	a = (Pixel>>24);						\
   353 }
   354 #define RGBA_FROM_BGRA8888(Pixel, r, g, b, a)				\
   355 {									\
   356 	r = ((Pixel>>8)&0xFF);						\
   357 	g = ((Pixel>>16)&0xFF);						\
   358 	b = (Pixel>>24);						\
   359 	a = (Pixel&0xFF);						\
   360 }
   361 #define DISEMBLE_RGBA(buf, bpp, fmt, Pixel, r, g, b, a)			   \
   362 do {									   \
   363 	switch (bpp) {							   \
   364 		case 2:							   \
   365 			Pixel = *((Uint16 *)(buf));			   \
   366 			RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a);	   \
   367 		break;							   \
   368 									   \
   369 		case 3:	{						   \
   370                         if (SDL_BYTEORDER == SDL_LIL_ENDIAN) {		   \
   371 			        r = *((buf)+fmt->Rshift/8);		   \
   372 				g = *((buf)+fmt->Gshift/8);		   \
   373 				b = *((buf)+fmt->Bshift/8);		   \
   374 			} else {					   \
   375 			        r = *((buf)+2-fmt->Rshift/8);		   \
   376 				g = *((buf)+2-fmt->Gshift/8);		   \
   377 				b = *((buf)+2-fmt->Bshift/8);		   \
   378 			}						   \
   379 			a = 0xFF;					   \
   380 		}							   \
   381 		break;							   \
   382 									   \
   383 		case 4:							   \
   384 			Pixel = *((Uint32 *)(buf));			   \
   385 			RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a);	   \
   386 		break;							   \
   387 									   \
   388 		default:						   \
   389 		        Pixel; /* stop gcc complaints */		   \
   390 		break;							   \
   391 	}								   \
   392 } while (0)
   393 
   394 /* FIXME: this isn't correct, especially for Alpha (maximum != 255) */
   395 #define PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a)				\
   396 {									\
   397 	Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)|				\
   398 		((g>>fmt->Gloss)<<fmt->Gshift)|				\
   399 		((b>>fmt->Bloss)<<fmt->Bshift)|				\
   400 		((a>>fmt->Aloss)<<fmt->Ashift);				\
   401 }
   402 #define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)			\
   403 {									\
   404 	switch (bpp) {							\
   405 		case 2: {						\
   406 			Uint16 Pixel;					\
   407 									\
   408 			PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a);	\
   409 			*((Uint16 *)(buf)) = Pixel | NDS_BIT15;		\
   410 		}							\
   411 		break;							\
   412 									\
   413 		case 3: {						\
   414                         if (SDL_BYTEORDER == SDL_LIL_ENDIAN) {		\
   415 			        *((buf)+fmt->Rshift/8) = r;		\
   416 				*((buf)+fmt->Gshift/8) = g;		\
   417 				*((buf)+fmt->Bshift/8) = b;		\
   418 			} else {					\
   419 			        *((buf)+2-fmt->Rshift/8) = r;		\
   420 				*((buf)+2-fmt->Gshift/8) = g;		\
   421 				*((buf)+2-fmt->Bshift/8) = b;		\
   422 			}						\
   423 		}							\
   424 		break;							\
   425 									\
   426 		case 4: {						\
   427 			Uint32 Pixel;					\
   428 									\
   429 			PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a);	\
   430 			*((Uint32 *)(buf)) = Pixel;			\
   431 		}							\
   432 		break;							\
   433 	}								\
   434 }
   435 
   436 /* Blend the RGB values of two Pixels based on a source alpha value */
   437 #define ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB)	\
   438 do {						\
   439 	dR = ((((int)(sR-dR)*(int)A)/255)+dR);	\
   440 	dG = ((((int)(sG-dG)*(int)A)/255)+dG);	\
   441 	dB = ((((int)(sB-dB)*(int)A)/255)+dB);	\
   442 } while(0)
   443 
   444 
   445 /* This is a very useful loop for optimizing blitters */
   446 #if defined(_MSC_VER) && (_MSC_VER == 1300)
   447 /* There's a bug in the Visual C++ 7 optimizer when compiling this code */
   448 #else
   449 #define USE_DUFFS_LOOP
   450 #endif
   451 #ifdef USE_DUFFS_LOOP
   452 
   453 /* 8-times unrolled loop */
   454 #define DUFFS_LOOP8(pixel_copy_increment, width)			\
   455 { int n = (width+7)/8;							\
   456 	switch (width & 7) {						\
   457 	case 0: do {	pixel_copy_increment;				\
   458 	case 7:		pixel_copy_increment;				\
   459 	case 6:		pixel_copy_increment;				\
   460 	case 5:		pixel_copy_increment;				\
   461 	case 4:		pixel_copy_increment;				\
   462 	case 3:		pixel_copy_increment;				\
   463 	case 2:		pixel_copy_increment;				\
   464 	case 1:		pixel_copy_increment;				\
   465 		} while ( --n > 0 );					\
   466 	}								\
   467 }
   468 
   469 /* 4-times unrolled loop */
   470 #define DUFFS_LOOP4(pixel_copy_increment, width)			\
   471 { int n = (width+3)/4;							\
   472 	switch (width & 3) {						\
   473 	case 0: do {	pixel_copy_increment;				\
   474 	case 3:		pixel_copy_increment;				\
   475 	case 2:		pixel_copy_increment;				\
   476 	case 1:		pixel_copy_increment;				\
   477 		} while (--n > 0);					\
   478 	}								\
   479 }
   480 
   481 /* Use the 8-times version of the loop by default */
   482 #define DUFFS_LOOP(pixel_copy_increment, width)				\
   483 	DUFFS_LOOP8(pixel_copy_increment, width)
   484 
   485 /* Special version of Duff's device for even more optimization */
   486 #define DUFFS_LOOP_124(pixel_copy_increment1,				\
   487                        pixel_copy_increment2,				\
   488                        pixel_copy_increment4, width)			\
   489 { int n = width;							\
   490 	if (n & 1) {							\
   491 		pixel_copy_increment1; n -= 1;				\
   492 	}								\
   493 	if (n & 2) {							\
   494 		pixel_copy_increment2; n -= 2;				\
   495 	}								\
   496 	if (n) {							\
   497 		n = (n+7)/ 8;						\
   498 		switch (n & 4) {					\
   499 		case 0: do {	pixel_copy_increment4;			\
   500 		case 4:		pixel_copy_increment4;			\
   501 			} while (--n > 0);				\
   502 		}							\
   503 	}								\
   504 }
   505 
   506 #else
   507 
   508 /* Don't use Duff's device to unroll loops */
   509 #define DUFFS_LOOP(pixel_copy_increment, width)				\
   510 { int n;								\
   511 	for ( n=width; n > 0; --n ) {					\
   512 		pixel_copy_increment;					\
   513 	}								\
   514 }
   515 #define DUFFS_LOOP8(pixel_copy_increment, width)			\
   516 	DUFFS_LOOP(pixel_copy_increment, width)
   517 #define DUFFS_LOOP4(pixel_copy_increment, width)			\
   518 	DUFFS_LOOP(pixel_copy_increment, width)
   519 #define DUFFS_LOOP_124(pixel_copy_increment1,				\
   520                        pixel_copy_increment2,				\
   521                        pixel_copy_increment4, width)			\
   522 	DUFFS_LOOP(pixel_copy_increment1, width)
   523 
   524 #endif /* USE_DUFFS_LOOP */
   525 
   526 /* Prevent Visual C++ 6.0 from printing out stupid warnings */
   527 #if defined(_MSC_VER) && (_MSC_VER >= 600)
   528 #pragma warning(disable: 4550)
   529 #endif
   530 
   531 #endif /* _SDL_blit_h */
   532 
   533 /* vi: set ts=4 sw=4 expandtab: */