src/video/SDL_blit.h
author Edgar Simo <bobbens@gmail.com>
Sun, 06 Jul 2008 17:06:37 +0000
branchgsoc2008_force_feedback
changeset 2498 ab567bd667bf
parent 2267 c785543d1843
child 2824 4dba7aa7ea77
permissions -rw-r--r--
Fixed various mistakes in the doxygen.
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2006 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 #ifdef __MMX__
    28 #include <mmintrin.h>
    29 #endif
    30 #ifdef __3dNOW__
    31 #include <mm3dnow.h>
    32 #endif
    33 #ifdef __SSE__
    34 #include <xmmintrin.h>
    35 #endif
    36 #ifdef __SSE2__
    37 #include <emmintrin.h>
    38 #endif
    39 
    40 #include "SDL_cpuinfo.h"
    41 #include "SDL_endian.h"
    42 
    43 /* SDL blit copy flags */
    44 #define SDL_COPY_MODULATE_COLOR     0x00000001
    45 #define SDL_COPY_MODULATE_ALPHA     0x00000002
    46 #define SDL_COPY_MASK               0x00000010
    47 #define SDL_COPY_BLEND              0x00000020
    48 #define SDL_COPY_ADD                0x00000040
    49 #define SDL_COPY_MOD                0x00000080
    50 #define SDL_COPY_COLORKEY           0x00000100
    51 #define SDL_COPY_NEAREST            0x00000200
    52 #define SDL_COPY_RLE_DESIRED        0x00001000
    53 #define SDL_COPY_RLE_COLORKEY       0x00002000
    54 #define SDL_COPY_RLE_ALPHAKEY       0x00004000
    55 
    56 /* SDL blit CPU flags */
    57 #define SDL_CPU_ANY                 0x00000000
    58 #define SDL_CPU_MMX                 0x00000001
    59 #define SDL_CPU_3DNOW               0x00000002
    60 #define SDL_CPU_SSE                 0x00000004
    61 #define SDL_CPU_SSE2                0x00000008
    62 #define SDL_CPU_ALTIVEC_PREFETCH    0x00000010
    63 #define SDL_CPU_ALTIVEC_NOPREFETCH  0x00000020
    64 
    65 typedef struct
    66 {
    67     Uint8 *src;
    68     int src_w, src_h;
    69     int src_pitch;
    70     int src_skip;
    71     Uint8 *dst;
    72     int dst_w, dst_h;
    73     int dst_pitch;
    74     int dst_skip;
    75     SDL_PixelFormat *src_fmt;
    76     SDL_PixelFormat *dst_fmt;
    77     Uint8 *table;
    78     int flags;
    79     Uint32 colorkey;
    80     Uint8 r, g, b, a;
    81 } SDL_BlitInfo;
    82 
    83 typedef void (SDLCALL * SDL_BlitFunc) (SDL_BlitInfo * info);
    84 
    85 typedef struct
    86 {
    87     Uint32 src_format;
    88     Uint32 dst_format;
    89     int flags;
    90     int cpu;
    91     SDL_BlitFunc func;
    92 } SDL_BlitFuncEntry;
    93 
    94 /* Blit mapping definition */
    95 typedef struct SDL_BlitMap
    96 {
    97     SDL_Surface *dst;
    98     int identity;
    99     SDL_blit blit;
   100     void *data;
   101     SDL_BlitInfo info;
   102 
   103     /* the version count matches the destination; mismatch indicates
   104        an invalid mapping */
   105     unsigned int format_version;
   106 } SDL_BlitMap;
   107 
   108 /* Functions found in SDL_blit.c */
   109 extern int SDL_CalculateBlit(SDL_Surface * surface);
   110 
   111 /* Functions found in SDL_blit_*.c */
   112 extern SDL_BlitFunc SDL_CalculateBlit0(SDL_Surface * surface);
   113 extern SDL_BlitFunc SDL_CalculateBlit1(SDL_Surface * surface);
   114 extern SDL_BlitFunc SDL_CalculateBlitN(SDL_Surface * surface);
   115 extern SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface * surface);
   116 
   117 /*
   118  * Useful macros for blitting routines
   119  */
   120 
   121 #if defined(__GNUC__)
   122 #define DECLARE_ALIGNED(t,v,a)  t __attribute__((aligned(a))) v
   123 #elif defined(_MSC_VER)
   124 #define DECLARE_ALIGNED(t,v,a)  __declspec(align(a)) t v
   125 #else
   126 #define DECLARE_ALIGNED(t,v,a)  t v
   127 #endif
   128 
   129 #define FORMAT_EQUAL(A, B)						\
   130     ((A)->BitsPerPixel == (B)->BitsPerPixel				\
   131      && ((A)->Rmask == (B)->Rmask) && ((A)->Amask == (B)->Amask))
   132 
   133 /* Load pixel of the specified format from a buffer and get its R-G-B values */
   134 /* FIXME: rescale values to 0..255 here? */
   135 #define RGB_FROM_PIXEL(Pixel, fmt, r, g, b)				\
   136 {									\
   137 	r = (((Pixel&fmt->Rmask)>>fmt->Rshift)<<fmt->Rloss); 		\
   138 	g = (((Pixel&fmt->Gmask)>>fmt->Gshift)<<fmt->Gloss); 		\
   139 	b = (((Pixel&fmt->Bmask)>>fmt->Bshift)<<fmt->Bloss); 		\
   140 }
   141 #define RGB_FROM_RGB565(Pixel, r, g, b)					\
   142 {									\
   143 	r = (((Pixel&0xF800)>>11)<<3);		 			\
   144 	g = (((Pixel&0x07E0)>>5)<<2); 					\
   145 	b = ((Pixel&0x001F)<<3); 					\
   146 }
   147 #define RGB_FROM_RGB555(Pixel, r, g, b)					\
   148 {									\
   149 	r = (((Pixel&0x7C00)>>10)<<3);		 			\
   150 	g = (((Pixel&0x03E0)>>5)<<3); 					\
   151 	b = ((Pixel&0x001F)<<3); 					\
   152 }
   153 #define RGB_FROM_RGB888(Pixel, r, g, b)					\
   154 {									\
   155 	r = ((Pixel&0xFF0000)>>16);		 			\
   156 	g = ((Pixel&0xFF00)>>8);		 			\
   157 	b = (Pixel&0xFF);			 			\
   158 }
   159 #define RETRIEVE_RGB_PIXEL(buf, bpp, Pixel)				   \
   160 do {									   \
   161 	switch (bpp) {							   \
   162 		case 2:							   \
   163 			Pixel = *((Uint16 *)(buf));			   \
   164 		break;							   \
   165 									   \
   166 		case 3: {						   \
   167 		        Uint8 *B = (Uint8 *)(buf);			   \
   168 			if(SDL_BYTEORDER == SDL_LIL_ENDIAN) {		   \
   169 			        Pixel = B[0] + (B[1] << 8) + (B[2] << 16); \
   170 			} else {					   \
   171 			        Pixel = (B[0] << 16) + (B[1] << 8) + B[2]; \
   172 			}						   \
   173 		}							   \
   174 		break;							   \
   175 									   \
   176 		case 4:							   \
   177 			Pixel = *((Uint32 *)(buf));			   \
   178 		break;							   \
   179 									   \
   180 		default:						   \
   181 			Pixel = 0; /* appease gcc */			   \
   182 		break;							   \
   183 	}								   \
   184 } while(0)
   185 
   186 #define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b)			   \
   187 do {									   \
   188 	switch (bpp) {							   \
   189 		case 2:							   \
   190 			Pixel = *((Uint16 *)(buf));			   \
   191 		break;							   \
   192 									   \
   193 		case 3: {						   \
   194 		        Uint8 *B = (Uint8 *)buf;			   \
   195 			if(SDL_BYTEORDER == SDL_LIL_ENDIAN) {		   \
   196 			        Pixel = B[0] + (B[1] << 8) + (B[2] << 16); \
   197 			} else {					   \
   198 			        Pixel = (B[0] << 16) + (B[1] << 8) + B[2]; \
   199 			}						   \
   200 		}							   \
   201 		break;							   \
   202 									   \
   203 		case 4:							   \
   204 			Pixel = *((Uint32 *)(buf));			   \
   205 		break;							   \
   206 									   \
   207 	        default:						   \
   208 		        Pixel = 0;	/* prevent gcc from complaining */ \
   209 		break;							   \
   210 	}								   \
   211 	RGB_FROM_PIXEL(Pixel, fmt, r, g, b);				   \
   212 } while(0)
   213 
   214 /* Assemble R-G-B values into a specified pixel format and store them */
   215 #define PIXEL_FROM_RGB(Pixel, fmt, r, g, b)				\
   216 {									\
   217 	Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)|				\
   218 		((g>>fmt->Gloss)<<fmt->Gshift)|				\
   219 		((b>>fmt->Bloss)<<fmt->Bshift);				\
   220 }
   221 #define RGB565_FROM_RGB(Pixel, r, g, b)					\
   222 {									\
   223 	Pixel = ((r>>3)<<11)|((g>>2)<<5)|(b>>3);			\
   224 }
   225 #define RGB555_FROM_RGB(Pixel, r, g, b)					\
   226 {									\
   227 	Pixel = ((r>>3)<<10)|((g>>3)<<5)|(b>>3);			\
   228 }
   229 #define RGB888_FROM_RGB(Pixel, r, g, b)					\
   230 {									\
   231 	Pixel = (r<<16)|(g<<8)|b;					\
   232 }
   233 #define ASSEMBLE_RGB(buf, bpp, fmt, r, g, b) 				\
   234 {									\
   235 	switch (bpp) {							\
   236 		case 2: {						\
   237 			Uint16 Pixel;					\
   238 									\
   239 			PIXEL_FROM_RGB(Pixel, fmt, r, g, b);		\
   240 			*((Uint16 *)(buf)) = Pixel;			\
   241 		}							\
   242 		break;							\
   243 									\
   244 		case 3: {						\
   245                         if(SDL_BYTEORDER == SDL_LIL_ENDIAN) {		\
   246 			        *((buf)+fmt->Rshift/8) = r;		\
   247 				*((buf)+fmt->Gshift/8) = g;		\
   248 				*((buf)+fmt->Bshift/8) = b;		\
   249 			} else {					\
   250 			        *((buf)+2-fmt->Rshift/8) = r;		\
   251 				*((buf)+2-fmt->Gshift/8) = g;		\
   252 				*((buf)+2-fmt->Bshift/8) = b;		\
   253 			}						\
   254 		}							\
   255 		break;							\
   256 									\
   257 		case 4: {						\
   258 			Uint32 Pixel;					\
   259 									\
   260 			PIXEL_FROM_RGB(Pixel, fmt, r, g, b);		\
   261 			*((Uint32 *)(buf)) = Pixel;			\
   262 		}							\
   263 		break;							\
   264 	}								\
   265 }
   266 #define ASSEMBLE_RGB_AMASK(buf, bpp, fmt, r, g, b, Amask)		\
   267 {									\
   268 	switch (bpp) {							\
   269 		case 2: {						\
   270 			Uint16 *bufp;					\
   271 			Uint16 Pixel;					\
   272 									\
   273 			bufp = (Uint16 *)buf;				\
   274 			PIXEL_FROM_RGB(Pixel, fmt, r, g, b);		\
   275 			*bufp = Pixel | (*bufp & Amask);		\
   276 		}							\
   277 		break;							\
   278 									\
   279 		case 3: {						\
   280                         if(SDL_BYTEORDER == SDL_LIL_ENDIAN) {		\
   281 			        *((buf)+fmt->Rshift/8) = r;		\
   282 				*((buf)+fmt->Gshift/8) = g;		\
   283 				*((buf)+fmt->Bshift/8) = b;		\
   284 			} else {					\
   285 			        *((buf)+2-fmt->Rshift/8) = r;		\
   286 				*((buf)+2-fmt->Gshift/8) = g;		\
   287 				*((buf)+2-fmt->Bshift/8) = b;		\
   288 			}						\
   289 		}							\
   290 		break;							\
   291 									\
   292 		case 4: {						\
   293 			Uint32 *bufp;					\
   294 			Uint32 Pixel;					\
   295 									\
   296 			bufp = (Uint32 *)buf;				\
   297 			PIXEL_FROM_RGB(Pixel, fmt, r, g, b);		\
   298 			*bufp = Pixel | (*bufp & Amask);		\
   299 		}							\
   300 		break;							\
   301 	}								\
   302 }
   303 
   304 /* FIXME: Should we rescale alpha into 0..255 here? */
   305 #define RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a)				\
   306 {									\
   307 	r = ((Pixel&fmt->Rmask)>>fmt->Rshift)<<fmt->Rloss; 		\
   308 	g = ((Pixel&fmt->Gmask)>>fmt->Gshift)<<fmt->Gloss; 		\
   309 	b = ((Pixel&fmt->Bmask)>>fmt->Bshift)<<fmt->Bloss; 		\
   310 	a = ((Pixel&fmt->Amask)>>fmt->Ashift)<<fmt->Aloss;	 	\
   311 }
   312 #define RGBA_FROM_8888(Pixel, fmt, r, g, b, a)	\
   313 {						\
   314 	r = (Pixel&fmt->Rmask)>>fmt->Rshift;	\
   315 	g = (Pixel&fmt->Gmask)>>fmt->Gshift;	\
   316 	b = (Pixel&fmt->Bmask)>>fmt->Bshift;	\
   317 	a = (Pixel&fmt->Amask)>>fmt->Ashift;	\
   318 }
   319 #define RGBA_FROM_RGBA8888(Pixel, r, g, b, a)				\
   320 {									\
   321 	r = (Pixel>>24);						\
   322 	g = ((Pixel>>16)&0xFF);						\
   323 	b = ((Pixel>>8)&0xFF);						\
   324 	a = (Pixel&0xFF);						\
   325 }
   326 #define RGBA_FROM_ARGB8888(Pixel, r, g, b, a)				\
   327 {									\
   328 	r = ((Pixel>>16)&0xFF);						\
   329 	g = ((Pixel>>8)&0xFF);						\
   330 	b = (Pixel&0xFF);						\
   331 	a = (Pixel>>24);						\
   332 }
   333 #define RGBA_FROM_ABGR8888(Pixel, r, g, b, a)				\
   334 {									\
   335 	r = (Pixel&0xFF);						\
   336 	g = ((Pixel>>8)&0xFF);						\
   337 	b = ((Pixel>>16)&0xFF);						\
   338 	a = (Pixel>>24);						\
   339 }
   340 #define DISEMBLE_RGBA(buf, bpp, fmt, Pixel, r, g, b, a)			   \
   341 do {									   \
   342 	switch (bpp) {							   \
   343 		case 2:							   \
   344 			Pixel = *((Uint16 *)(buf));			   \
   345 		break;							   \
   346 									   \
   347 		case 3:	{/* FIXME: broken code (no alpha) */		   \
   348 		        Uint8 *b = (Uint8 *)buf;			   \
   349 			if(SDL_BYTEORDER == SDL_LIL_ENDIAN) {		   \
   350 			        Pixel = b[0] + (b[1] << 8) + (b[2] << 16); \
   351 			} else {					   \
   352 			        Pixel = (b[0] << 16) + (b[1] << 8) + b[2]; \
   353 			}						   \
   354 		}							   \
   355 		break;							   \
   356 									   \
   357 		case 4:							   \
   358 			Pixel = *((Uint32 *)(buf));			   \
   359 		break;							   \
   360 									   \
   361 		default:						   \
   362 		        Pixel = 0; /* stop gcc complaints */		   \
   363 		break;							   \
   364 	}								   \
   365 	RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a);			   \
   366 	Pixel &= ~fmt->Amask;						   \
   367 } while(0)
   368 
   369 /* FIXME: this isn't correct, especially for Alpha (maximum != 255) */
   370 #define PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a)				\
   371 {									\
   372 	Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)|				\
   373 		((g>>fmt->Gloss)<<fmt->Gshift)|				\
   374 		((b>>fmt->Bloss)<<fmt->Bshift)|				\
   375 		((a>>fmt->Aloss)<<fmt->Ashift);				\
   376 }
   377 #define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)			\
   378 {									\
   379 	switch (bpp) {							\
   380 		case 2: {						\
   381 			Uint16 Pixel;					\
   382 									\
   383 			PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a);	\
   384 			*((Uint16 *)(buf)) = Pixel;			\
   385 		}							\
   386 		break;							\
   387 									\
   388 		case 3: { /* FIXME: broken code (no alpha) */		\
   389                         if(SDL_BYTEORDER == SDL_LIL_ENDIAN) {		\
   390 			        *((buf)+fmt->Rshift/8) = r;		\
   391 				*((buf)+fmt->Gshift/8) = g;		\
   392 				*((buf)+fmt->Bshift/8) = b;		\
   393 			} else {					\
   394 			        *((buf)+2-fmt->Rshift/8) = r;		\
   395 				*((buf)+2-fmt->Gshift/8) = g;		\
   396 				*((buf)+2-fmt->Bshift/8) = b;		\
   397 			}						\
   398 		}							\
   399 		break;							\
   400 									\
   401 		case 4: {						\
   402 			Uint32 Pixel;					\
   403 									\
   404 			PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a);	\
   405 			*((Uint32 *)(buf)) = Pixel;			\
   406 		}							\
   407 		break;							\
   408 	}								\
   409 }
   410 
   411 /* Blend the RGB values of two Pixels based on a source alpha value */
   412 #define ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB)	\
   413 do {						\
   414 	dR = (((sR-dR)*(A))>>8)+dR;		\
   415 	dG = (((sG-dG)*(A))>>8)+dG;		\
   416 	dB = (((sB-dB)*(A))>>8)+dB;		\
   417 } while(0)
   418 
   419 /* Blend the RGB values of two Pixels based on a source alpha value */
   420 #define ACCURATE_ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB)	\
   421 do {						\
   422     unsigned tR, tG, tB, tA; \
   423     tA = 255 - sA; \
   424     tR = 1 + (sR * sA) + (dR * tA); \
   425     dR = (tR + (tR >> 8)) >> 8; \
   426     tG = 1 + (sG * sA) + (dG * tA); \
   427     dG = (tG + (tG >> 8)) >> 8; \
   428     tB = 1 + (sB * sA) + (dB * tA); \
   429     dB = (tB + (tB >> 8)) >> 8; \
   430 } while(0)
   431 
   432 
   433 /* This is a very useful loop for optimizing blitters */
   434 #if defined(_MSC_VER) && (_MSC_VER == 1300)
   435 /* There's a bug in the Visual C++ 7 optimizer when compiling this code */
   436 #else
   437 #define USE_DUFFS_LOOP
   438 #endif
   439 #ifdef USE_DUFFS_LOOP
   440 
   441 /* 8-times unrolled loop */
   442 #define DUFFS_LOOP8(pixel_copy_increment, width)			\
   443 { int n = (width+7)/8;							\
   444 	switch (width & 7) {						\
   445 	case 0: do {	pixel_copy_increment;				\
   446 	case 7:		pixel_copy_increment;				\
   447 	case 6:		pixel_copy_increment;				\
   448 	case 5:		pixel_copy_increment;				\
   449 	case 4:		pixel_copy_increment;				\
   450 	case 3:		pixel_copy_increment;				\
   451 	case 2:		pixel_copy_increment;				\
   452 	case 1:		pixel_copy_increment;				\
   453 		} while ( --n > 0 );					\
   454 	}								\
   455 }
   456 
   457 /* 4-times unrolled loop */
   458 #define DUFFS_LOOP4(pixel_copy_increment, width)			\
   459 { int n = (width+3)/4;							\
   460 	switch (width & 3) {						\
   461 	case 0: do {	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 /* 2 - times unrolled loop */
   470 #define DUFFS_LOOP_DOUBLE2(pixel_copy_increment,			\
   471 				double_pixel_copy_increment, width)	\
   472 { int n, w = width;							\
   473 	if( w & 1 ) {							\
   474 	    pixel_copy_increment;					\
   475 	    w--;							\
   476 	}								\
   477 	if ( w > 0 )	{						\
   478 	    n = ( w + 2) / 4;						\
   479 	    switch( w & 2 ) {						\
   480 	    case 0: do {	double_pixel_copy_increment;		\
   481 	    case 2:		double_pixel_copy_increment;		\
   482 		    } while ( --n > 0 );					\
   483 	    }								\
   484 	}								\
   485 }
   486 
   487 /* 2 - times unrolled loop 4 pixels */
   488 #define DUFFS_LOOP_QUATRO2(pixel_copy_increment,			\
   489 				double_pixel_copy_increment,		\
   490 				quatro_pixel_copy_increment, width)	\
   491 { int n, w = width;								\
   492         if(w & 1) {							\
   493 	  pixel_copy_increment;						\
   494 	  w--;								\
   495 	}								\
   496 	if(w & 2) {							\
   497 	  double_pixel_copy_increment;					\
   498 	  w -= 2;							\
   499 	}								\
   500 	if ( w > 0 ) {							\
   501 	    n = ( w + 7 ) / 8;						\
   502 	    switch( w & 4 ) {						\
   503 	    case 0: do {	quatro_pixel_copy_increment;		\
   504 	    case 4:		quatro_pixel_copy_increment;		\
   505 		    } while ( --n > 0 );					\
   506 	    }								\
   507 	}								\
   508 }
   509 
   510 /* Use the 8-times version of the loop by default */
   511 #define DUFFS_LOOP(pixel_copy_increment, width)				\
   512 	DUFFS_LOOP8(pixel_copy_increment, width)
   513 
   514 #else
   515 
   516 /* Don't use Duff's device to unroll loops */
   517 #define DUFFS_LOOP_DOUBLE2(pixel_copy_increment,			\
   518 			 double_pixel_copy_increment, width)		\
   519 { int n = width;								\
   520     if( n & 1 ) {							\
   521 	pixel_copy_increment;						\
   522 	n--;								\
   523     }									\
   524     n=n>>1;								\
   525     for(; n > 0; --n) {   						\
   526 	double_pixel_copy_increment;					\
   527     }									\
   528 }
   529 
   530 /* Don't use Duff's device to unroll loops */
   531 #define DUFFS_LOOP_QUATRO2(pixel_copy_increment,			\
   532 				double_pixel_copy_increment,		\
   533 				quatro_pixel_copy_increment, width)	\
   534 { int n = width;								\
   535         if(n & 1) {							\
   536 	  pixel_copy_increment;						\
   537 	  n--;								\
   538 	}								\
   539 	if(n & 2) {							\
   540 	  double_pixel_copy_increment;					\
   541 	  n -= 2;							\
   542 	}								\
   543 	n=n>>2;								\
   544 	for(; n > 0; --n) {   						\
   545 	  quatro_pixel_copy_increment;					\
   546         }								\
   547 }
   548 
   549 /* Don't use Duff's device to unroll loops */
   550 #define DUFFS_LOOP(pixel_copy_increment, width)				\
   551 { int n;								\
   552 	for ( n=width; n > 0; --n ) {					\
   553 		pixel_copy_increment;					\
   554 	}								\
   555 }
   556 #define DUFFS_LOOP8(pixel_copy_increment, width)			\
   557 	DUFFS_LOOP(pixel_copy_increment, width)
   558 #define DUFFS_LOOP4(pixel_copy_increment, width)			\
   559 	DUFFS_LOOP(pixel_copy_increment, width)
   560 
   561 #endif /* USE_DUFFS_LOOP */
   562 
   563 /* Prevent Visual C++ 6.0 from printing out stupid warnings */
   564 #if defined(_MSC_VER) && (_MSC_VER >= 600)
   565 #pragma warning(disable: 4550)
   566 #endif
   567 
   568 #endif /* _SDL_blit_h */
   569 /* vi: set ts=4 sw=4 expandtab: */