src/video/SDL_blit.h
author Sam Lantinga <slouken@lokigames.com>
Thu, 26 Apr 2001 16:45:43 +0000
changeset 0 74212992fb08
child 91 e85e03f195b4
permissions -rw-r--r--
Initial revision
slouken@0
     1
/*
slouken@0
     2
    SDL - Simple DirectMedia Layer
slouken@0
     3
    Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
slouken@0
     4
slouken@0
     5
    This library is free software; you can redistribute it and/or
slouken@0
     6
    modify it under the terms of the GNU Library General Public
slouken@0
     7
    License as published by the Free Software Foundation; either
slouken@0
     8
    version 2 of the License, or (at your option) any later version.
slouken@0
     9
slouken@0
    10
    This library is distributed in the hope that it will be useful,
slouken@0
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@0
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@0
    13
    Library General Public License for more details.
slouken@0
    14
slouken@0
    15
    You should have received a copy of the GNU Library General Public
slouken@0
    16
    License along with this library; if not, write to the Free
slouken@0
    17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
slouken@0
    18
slouken@0
    19
    Sam Lantinga
slouken@0
    20
    slouken@devolution.com
slouken@0
    21
*/
slouken@0
    22
slouken@0
    23
#ifdef SAVE_RCSID
slouken@0
    24
static char rcsid =
slouken@0
    25
 "@(#) $Id$";
slouken@0
    26
#endif
slouken@0
    27
slouken@0
    28
#ifndef _SDL_blit_h
slouken@0
    29
#define _SDL_blit_h
slouken@0
    30
slouken@0
    31
#include "SDL_endian.h"
slouken@0
    32
slouken@0
    33
/* The structure passed to the low level blit functions */
slouken@0
    34
typedef struct {
slouken@0
    35
	Uint8 *s_pixels;
slouken@0
    36
	int s_width;
slouken@0
    37
	int s_height;
slouken@0
    38
	int s_skip;
slouken@0
    39
	Uint8 *d_pixels;
slouken@0
    40
	int d_width;
slouken@0
    41
	int d_height;
slouken@0
    42
	int d_skip;
slouken@0
    43
	void *aux_data;
slouken@0
    44
	SDL_PixelFormat *src;
slouken@0
    45
	Uint8 *table;
slouken@0
    46
	SDL_PixelFormat *dst;
slouken@0
    47
} SDL_BlitInfo;
slouken@0
    48
slouken@0
    49
/* The type definition for the low level blit functions */
slouken@0
    50
typedef void (*SDL_loblit)(SDL_BlitInfo *info);
slouken@0
    51
slouken@0
    52
/* This is the private info structure for software accelerated blits */
slouken@0
    53
struct private_swaccel {
slouken@0
    54
	SDL_loblit blit;
slouken@0
    55
	void *aux_data;
slouken@0
    56
};
slouken@0
    57
slouken@0
    58
/* Blit mapping definition */
slouken@0
    59
typedef struct SDL_BlitMap {
slouken@0
    60
	SDL_Surface *dst;
slouken@0
    61
	int identity;
slouken@0
    62
	Uint8 *table;
slouken@0
    63
	SDL_blit hw_blit;
slouken@0
    64
	SDL_blit sw_blit;
slouken@0
    65
	struct private_hwaccel *hw_data;
slouken@0
    66
	struct private_swaccel *sw_data;
slouken@0
    67
slouken@0
    68
	/* the version count matches the destination; mismatch indicates
slouken@0
    69
	   an invalid mapping */
slouken@0
    70
        unsigned int format_version;
slouken@0
    71
} SDL_BlitMap;
slouken@0
    72
slouken@0
    73
slouken@0
    74
/* Definitions for special global blit functions */
slouken@0
    75
#include "SDL_blit_A.h"
slouken@0
    76
slouken@0
    77
/* Functions found in SDL_blit.c */
slouken@0
    78
extern int SDL_CalculateBlit(SDL_Surface *surface);
slouken@0
    79
slouken@0
    80
/* Functions found in SDL_blit_{0,1,N,A}.c */
slouken@0
    81
extern SDL_loblit SDL_CalculateBlit0(SDL_Surface *surface, int complex);
slouken@0
    82
extern SDL_loblit SDL_CalculateBlit1(SDL_Surface *surface, int complex);
slouken@0
    83
extern SDL_loblit SDL_CalculateBlitN(SDL_Surface *surface, int complex);
slouken@0
    84
extern SDL_loblit SDL_CalculateAlphaBlit(SDL_Surface *surface, int complex);
slouken@0
    85
slouken@0
    86
/*
slouken@0
    87
 * Useful macros for blitting routines
slouken@0
    88
 */
slouken@0
    89
slouken@0
    90
#define FORMAT_EQUAL(A, B)						\
slouken@0
    91
    ((A)->BitsPerPixel == (B)->BitsPerPixel				\
slouken@0
    92
     && ((A)->Rmask == (B)->Rmask) && ((A)->Amask == (B)->Amask))
slouken@0
    93
slouken@0
    94
/* Load pixel of the specified format from a buffer and get its R-G-B values */
slouken@0
    95
/* FIXME: rescale values to 0..255 here? */
slouken@0
    96
#define RGB_FROM_PIXEL(pixel, fmt, r, g, b)				\
slouken@0
    97
{									\
slouken@0
    98
	r = (((pixel&fmt->Rmask)>>fmt->Rshift)<<fmt->Rloss); 		\
slouken@0
    99
	g = (((pixel&fmt->Gmask)>>fmt->Gshift)<<fmt->Gloss); 		\
slouken@0
   100
	b = (((pixel&fmt->Bmask)>>fmt->Bshift)<<fmt->Bloss); 		\
slouken@0
   101
}
slouken@0
   102
#define RGB_FROM_RGB565(pixel, r, g, b)					\
slouken@0
   103
{									\
slouken@0
   104
	r = (((pixel&0xF800)>>11)<<3);		 			\
slouken@0
   105
	g = (((pixel&0x07E0)>>5)<<2); 					\
slouken@0
   106
	b = ((pixel&0x001F)<<3); 					\
slouken@0
   107
}
slouken@0
   108
#define RGB_FROM_RGB555(pixel, r, g, b)					\
slouken@0
   109
{									\
slouken@0
   110
	r = (((pixel&0x7C00)>>10)<<3);		 			\
slouken@0
   111
	g = (((pixel&0x03E0)>>5)<<3); 					\
slouken@0
   112
	b = ((pixel&0x001F)<<3); 					\
slouken@0
   113
}
slouken@0
   114
#define RGB_FROM_RGB888(pixel, r, g, b)					\
slouken@0
   115
{									\
slouken@0
   116
	r = ((pixel&0xFF0000)>>16);		 			\
slouken@0
   117
	g = ((pixel&0xFF00)>>8);		 			\
slouken@0
   118
	b = (pixel&0xFF);			 			\
slouken@0
   119
}
slouken@0
   120
#define RETRIEVE_RGB_PIXEL(buf, bpp, pixel)				   \
slouken@0
   121
do {									   \
slouken@0
   122
	switch (bpp) {							   \
slouken@0
   123
		case 2:							   \
slouken@0
   124
			pixel = *((Uint16 *)(buf));			   \
slouken@0
   125
		break;							   \
slouken@0
   126
									   \
slouken@0
   127
		case 3: {						   \
slouken@0
   128
		        Uint8 *B = (Uint8 *)(buf);			   \
slouken@0
   129
			if(SDL_BYTEORDER == SDL_LIL_ENDIAN) {		   \
slouken@0
   130
			        pixel = B[0] + (B[1] << 8) + (B[2] << 16); \
slouken@0
   131
			} else {					   \
slouken@0
   132
			        pixel = (B[0] << 16) + (B[1] << 8) + B[2]; \
slouken@0
   133
			}						   \
slouken@0
   134
		}							   \
slouken@0
   135
		break;							   \
slouken@0
   136
									   \
slouken@0
   137
		case 4:							   \
slouken@0
   138
			pixel = *((Uint32 *)(buf));			   \
slouken@0
   139
		break;							   \
slouken@0
   140
									   \
slouken@0
   141
		default:						   \
slouken@0
   142
			pixel = 0; /* appease gcc */			   \
slouken@0
   143
		break;							   \
slouken@0
   144
	}								   \
slouken@0
   145
} while(0)
slouken@0
   146
slouken@0
   147
#define DISEMBLE_RGB(buf, bpp, fmt, pixel, r, g, b)			   \
slouken@0
   148
do {									   \
slouken@0
   149
	switch (bpp) {							   \
slouken@0
   150
		case 2:							   \
slouken@0
   151
			pixel = *((Uint16 *)(buf));			   \
slouken@0
   152
		break;							   \
slouken@0
   153
									   \
slouken@0
   154
		case 3: {						   \
slouken@0
   155
		        Uint8 *B = (Uint8 *)buf;			   \
slouken@0
   156
			if(SDL_BYTEORDER == SDL_LIL_ENDIAN) {		   \
slouken@0
   157
			        pixel = B[0] + (B[1] << 8) + (B[2] << 16); \
slouken@0
   158
			} else {					   \
slouken@0
   159
			        pixel = (B[0] << 16) + (B[1] << 8) + B[2]; \
slouken@0
   160
			}						   \
slouken@0
   161
		}							   \
slouken@0
   162
		break;							   \
slouken@0
   163
									   \
slouken@0
   164
		case 4:							   \
slouken@0
   165
			pixel = *((Uint32 *)(buf));			   \
slouken@0
   166
		break;							   \
slouken@0
   167
									   \
slouken@0
   168
	        default:						   \
slouken@0
   169
		        pixel = 0;	/* prevent gcc from complaining */ \
slouken@0
   170
		break;							   \
slouken@0
   171
	}								   \
slouken@0
   172
	RGB_FROM_PIXEL(pixel, fmt, r, g, b);				   \
slouken@0
   173
} while(0)
slouken@0
   174
slouken@0
   175
/* Assemble R-G-B values into a specified pixel format and store them */
slouken@0
   176
#define PIXEL_FROM_RGB(pixel, fmt, r, g, b)				\
slouken@0
   177
{									\
slouken@0
   178
	pixel = ((r>>fmt->Rloss)<<fmt->Rshift)|				\
slouken@0
   179
		((g>>fmt->Gloss)<<fmt->Gshift)|				\
slouken@0
   180
		((b>>fmt->Bloss)<<fmt->Bshift);				\
slouken@0
   181
}
slouken@0
   182
#define RGB565_FROM_RGB(pixel, r, g, b)					\
slouken@0
   183
{									\
slouken@0
   184
	pixel = ((r>>3)<<11)|((g>>2)<<5)|(b>>3);			\
slouken@0
   185
}
slouken@0
   186
#define RGB555_FROM_RGB(pixel, r, g, b)					\
slouken@0
   187
{									\
slouken@0
   188
	pixel = ((r>>3)<<10)|((g>>3)<<5)|(b>>3);			\
slouken@0
   189
}
slouken@0
   190
#define RGB888_FROM_RGB(pixel, r, g, b)					\
slouken@0
   191
{									\
slouken@0
   192
	pixel = (r<<16)|(g<<8)|b;					\
slouken@0
   193
}
slouken@0
   194
#define ASSEMBLE_RGB(buf, bpp, fmt, r, g, b) 				\
slouken@0
   195
{									\
slouken@0
   196
	switch (bpp) {							\
slouken@0
   197
		case 2: {						\
slouken@0
   198
			Uint16 pixel;					\
slouken@0
   199
									\
slouken@0
   200
			PIXEL_FROM_RGB(pixel, fmt, r, g, b);		\
slouken@0
   201
			*((Uint16 *)(buf)) = pixel;			\
slouken@0
   202
		}							\
slouken@0
   203
		break;							\
slouken@0
   204
									\
slouken@0
   205
		case 3: {						\
slouken@0
   206
                        if(SDL_BYTEORDER == SDL_LIL_ENDIAN) {		\
slouken@0
   207
			        *((buf)+fmt->Rshift/8) = r;		\
slouken@0
   208
				*((buf)+fmt->Gshift/8) = g;		\
slouken@0
   209
				*((buf)+fmt->Bshift/8) = b;		\
slouken@0
   210
			} else {					\
slouken@0
   211
			        *((buf)+2-fmt->Rshift/8) = r;		\
slouken@0
   212
				*((buf)+2-fmt->Gshift/8) = g;		\
slouken@0
   213
				*((buf)+2-fmt->Bshift/8) = b;		\
slouken@0
   214
			}						\
slouken@0
   215
		}							\
slouken@0
   216
		break;							\
slouken@0
   217
									\
slouken@0
   218
		case 4: {						\
slouken@0
   219
			Uint32 pixel;					\
slouken@0
   220
									\
slouken@0
   221
			PIXEL_FROM_RGB(pixel, fmt, r, g, b);		\
slouken@0
   222
			*((Uint32 *)(buf)) = pixel;			\
slouken@0
   223
		}							\
slouken@0
   224
		break;							\
slouken@0
   225
	}								\
slouken@0
   226
}
slouken@0
   227
#define ASSEMBLE_RGB_AMASK(buf, bpp, fmt, r, g, b, Amask)		\
slouken@0
   228
{									\
slouken@0
   229
	switch (bpp) {							\
slouken@0
   230
		case 2: {						\
slouken@0
   231
			Uint16 *bufp;					\
slouken@0
   232
			Uint16 pixel;					\
slouken@0
   233
									\
slouken@0
   234
			bufp = (Uint16 *)buf;				\
slouken@0
   235
			PIXEL_FROM_RGB(pixel, fmt, r, g, b);		\
slouken@0
   236
			*bufp = pixel | (*bufp & Amask);		\
slouken@0
   237
		}							\
slouken@0
   238
		break;							\
slouken@0
   239
									\
slouken@0
   240
		case 3: {						\
slouken@0
   241
                        if(SDL_BYTEORDER == SDL_LIL_ENDIAN) {		\
slouken@0
   242
			        *((buf)+fmt->Rshift/8) = r;		\
slouken@0
   243
				*((buf)+fmt->Gshift/8) = g;		\
slouken@0
   244
				*((buf)+fmt->Bshift/8) = b;		\
slouken@0
   245
			} else {					\
slouken@0
   246
			        *((buf)+2-fmt->Rshift/8) = r;		\
slouken@0
   247
				*((buf)+2-fmt->Gshift/8) = g;		\
slouken@0
   248
				*((buf)+2-fmt->Bshift/8) = b;		\
slouken@0
   249
			}						\
slouken@0
   250
		}							\
slouken@0
   251
		break;							\
slouken@0
   252
									\
slouken@0
   253
		case 4: {						\
slouken@0
   254
			Uint32 *bufp;					\
slouken@0
   255
			Uint32 pixel;					\
slouken@0
   256
									\
slouken@0
   257
			bufp = (Uint32 *)buf;				\
slouken@0
   258
			PIXEL_FROM_RGB(pixel, fmt, r, g, b);		\
slouken@0
   259
			*bufp = pixel | (*bufp & Amask);		\
slouken@0
   260
		}							\
slouken@0
   261
		break;							\
slouken@0
   262
	}								\
slouken@0
   263
}
slouken@0
   264
slouken@0
   265
/* FIXME: Should we rescale alpha into 0..255 here? */
slouken@0
   266
#define RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a)				\
slouken@0
   267
{									\
slouken@0
   268
	r = ((pixel&fmt->Rmask)>>fmt->Rshift)<<fmt->Rloss; 		\
slouken@0
   269
	g = ((pixel&fmt->Gmask)>>fmt->Gshift)<<fmt->Gloss; 		\
slouken@0
   270
	b = ((pixel&fmt->Bmask)>>fmt->Bshift)<<fmt->Bloss; 		\
slouken@0
   271
	a = ((pixel&fmt->Amask)>>fmt->Ashift)<<fmt->Aloss;	 	\
slouken@0
   272
}
slouken@0
   273
#define RGBA_FROM_8888(pixel, fmt, r, g, b, a)	\
slouken@0
   274
{						\
slouken@0
   275
	r = (pixel&fmt->Rmask)>>fmt->Rshift;	\
slouken@0
   276
	g = (pixel&fmt->Gmask)>>fmt->Gshift;	\
slouken@0
   277
	b = (pixel&fmt->Bmask)>>fmt->Bshift;	\
slouken@0
   278
	a = (pixel&fmt->Amask)>>fmt->Ashift;	\
slouken@0
   279
}
slouken@0
   280
#define RGBA_FROM_RGBA8888(pixel, r, g, b, a)				\
slouken@0
   281
{									\
slouken@0
   282
	r = (pixel>>24);						\
slouken@0
   283
	g = ((pixel>>16)&0xFF);						\
slouken@0
   284
	b = ((pixel>>8)&0xFF);						\
slouken@0
   285
	a = (pixel&0xFF);						\
slouken@0
   286
}
slouken@0
   287
#define RGBA_FROM_ARGB8888(pixel, r, g, b, a)				\
slouken@0
   288
{									\
slouken@0
   289
	r = ((pixel>>16)&0xFF);						\
slouken@0
   290
	g = ((pixel>>8)&0xFF);						\
slouken@0
   291
	b = (pixel&0xFF);						\
slouken@0
   292
	a = (pixel>>24);						\
slouken@0
   293
}
slouken@0
   294
#define RGBA_FROM_ABGR8888(pixel, r, g, b, a)				\
slouken@0
   295
{									\
slouken@0
   296
	r = (pixel&0xFF);						\
slouken@0
   297
	g = ((pixel>>8)&0xFF);						\
slouken@0
   298
	b = ((pixel>>16)&0xFF);						\
slouken@0
   299
	a = (pixel>>24);						\
slouken@0
   300
}
slouken@0
   301
#define DISEMBLE_RGBA(buf, bpp, fmt, pixel, r, g, b, a)			   \
slouken@0
   302
do {									   \
slouken@0
   303
	switch (bpp) {							   \
slouken@0
   304
		case 2:							   \
slouken@0
   305
			pixel = *((Uint16 *)(buf));			   \
slouken@0
   306
		break;							   \
slouken@0
   307
									   \
slouken@0
   308
		case 3:	{/* FIXME: broken code (no alpha) */		   \
slouken@0
   309
		        Uint8 *b = (Uint8 *)buf;			   \
slouken@0
   310
			if(SDL_BYTEORDER == SDL_LIL_ENDIAN) {		   \
slouken@0
   311
			        pixel = b[0] + (b[1] << 8) + (b[2] << 16); \
slouken@0
   312
			} else {					   \
slouken@0
   313
			        pixel = (b[0] << 16) + (b[1] << 8) + b[2]; \
slouken@0
   314
			}						   \
slouken@0
   315
		}							   \
slouken@0
   316
		break;							   \
slouken@0
   317
									   \
slouken@0
   318
		case 4:							   \
slouken@0
   319
			pixel = *((Uint32 *)(buf));			   \
slouken@0
   320
		break;							   \
slouken@0
   321
									   \
slouken@0
   322
		default:						   \
slouken@0
   323
		        pixel = 0; /* stop gcc complaints */		   \
slouken@0
   324
		break;							   \
slouken@0
   325
	}								   \
slouken@0
   326
	RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a);			   \
slouken@0
   327
	pixel &= ~fmt->Amask;						   \
slouken@0
   328
} while(0)
slouken@0
   329
slouken@0
   330
/* FIXME: this isn't correct, especially for Alpha (maximum != 255) */
slouken@0
   331
#define PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a)				\
slouken@0
   332
{									\
slouken@0
   333
	pixel = ((r>>fmt->Rloss)<<fmt->Rshift)|				\
slouken@0
   334
		((g>>fmt->Gloss)<<fmt->Gshift)|				\
slouken@0
   335
		((b>>fmt->Bloss)<<fmt->Bshift)|				\
slouken@0
   336
		((a<<fmt->Aloss)<<fmt->Ashift);				\
slouken@0
   337
}
slouken@0
   338
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)			\
slouken@0
   339
{									\
slouken@0
   340
	switch (bpp) {							\
slouken@0
   341
		case 2: {						\
slouken@0
   342
			Uint16 pixel;					\
slouken@0
   343
									\
slouken@0
   344
			PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a);	\
slouken@0
   345
			*((Uint16 *)(buf)) = pixel;			\
slouken@0
   346
		}							\
slouken@0
   347
		break;							\
slouken@0
   348
									\
slouken@0
   349
		case 3: { /* FIXME: broken code (no alpha) */		\
slouken@0
   350
                        if(SDL_BYTEORDER == SDL_LIL_ENDIAN) {		\
slouken@0
   351
			        *((buf)+fmt->Rshift/8) = r;		\
slouken@0
   352
				*((buf)+fmt->Gshift/8) = g;		\
slouken@0
   353
				*((buf)+fmt->Bshift/8) = b;		\
slouken@0
   354
			} else {					\
slouken@0
   355
			        *((buf)+2-fmt->Rshift/8) = r;		\
slouken@0
   356
				*((buf)+2-fmt->Gshift/8) = g;		\
slouken@0
   357
				*((buf)+2-fmt->Bshift/8) = b;		\
slouken@0
   358
			}						\
slouken@0
   359
		}							\
slouken@0
   360
		break;							\
slouken@0
   361
									\
slouken@0
   362
		case 4: {						\
slouken@0
   363
			Uint32 pixel;					\
slouken@0
   364
									\
slouken@0
   365
			PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a);	\
slouken@0
   366
			*((Uint32 *)(buf)) = pixel;			\
slouken@0
   367
		}							\
slouken@0
   368
		break;							\
slouken@0
   369
	}								\
slouken@0
   370
}
slouken@0
   371
slouken@0
   372
/* Blend the RGB values of two pixels based on a source alpha value */
slouken@0
   373
#define ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB)	\
slouken@0
   374
do {						\
slouken@0
   375
	dR = (((sR-dR)*(A))>>8)+dR;		\
slouken@0
   376
	dG = (((sG-dG)*(A))>>8)+dG;		\
slouken@0
   377
	dB = (((sB-dB)*(A))>>8)+dB;		\
slouken@0
   378
} while(0)
slouken@0
   379
slouken@0
   380
/* This is a very useful loop for optimizing blitters */
slouken@0
   381
#define USE_DUFFS_LOOP
slouken@0
   382
#ifdef USE_DUFFS_LOOP
slouken@0
   383
slouken@0
   384
/* 8-times unrolled loop */
slouken@0
   385
#define DUFFS_LOOP8(pixel_copy_increment, width)			\
slouken@0
   386
{ int n = (width+7)/8;							\
slouken@0
   387
	switch (width % 8) {						\
slouken@0
   388
	case 0: do {	pixel_copy_increment;				\
slouken@0
   389
	case 7:		pixel_copy_increment;				\
slouken@0
   390
	case 6:		pixel_copy_increment;				\
slouken@0
   391
	case 5:		pixel_copy_increment;				\
slouken@0
   392
	case 4:		pixel_copy_increment;				\
slouken@0
   393
	case 3:		pixel_copy_increment;				\
slouken@0
   394
	case 2:		pixel_copy_increment;				\
slouken@0
   395
	case 1:		pixel_copy_increment;				\
slouken@0
   396
		} while ( --n > 0 );					\
slouken@0
   397
	}								\
slouken@0
   398
}
slouken@0
   399
slouken@0
   400
/* 4-times unrolled loop */
slouken@0
   401
#define DUFFS_LOOP4(pixel_copy_increment, width)			\
slouken@0
   402
{ int n = (width+3)/4;							\
slouken@0
   403
	switch (width % 4) {						\
slouken@0
   404
	case 0: do {	pixel_copy_increment;				\
slouken@0
   405
	case 3:		pixel_copy_increment;				\
slouken@0
   406
	case 2:		pixel_copy_increment;				\
slouken@0
   407
	case 1:		pixel_copy_increment;				\
slouken@0
   408
		} while ( --n > 0 );					\
slouken@0
   409
	}								\
slouken@0
   410
}
slouken@0
   411
slouken@0
   412
/* Use the 8-times version of the loop by default */
slouken@0
   413
#define DUFFS_LOOP(pixel_copy_increment, width)				\
slouken@0
   414
	DUFFS_LOOP8(pixel_copy_increment, width)
slouken@0
   415
slouken@0
   416
#else
slouken@0
   417
slouken@0
   418
/* Don't use Duff's device to unroll loops */
slouken@0
   419
#define DUFFS_LOOP(pixel_copy_increment, width)				\
slouken@0
   420
{ int n;								\
slouken@0
   421
	for ( n=width; n > 0; --n ) {					\
slouken@0
   422
		pixel_copy_increment;					\
slouken@0
   423
	}								\
slouken@0
   424
}
slouken@0
   425
#define DUFFS_LOOP8(pixel_copy_increment, width)			\
slouken@0
   426
	DUFFS_LOOP(pixel_copy_increment, width)
slouken@0
   427
#define DUFFS_LOOP4(pixel_copy_increment, width)			\
slouken@0
   428
	DUFFS_LOOP(pixel_copy_increment, width)
slouken@0
   429
slouken@0
   430
#endif /* USE_DUFFS_LOOP */
slouken@0
   431
slouken@0
   432
/* Prevent Visual C++ 6.0 from printing out stupid warnings */
slouken@0
   433
#if defined(_MSC_VER) && (_MSC_VER >= 600)
slouken@0
   434
#pragma warning(disable: 4550)
slouken@0
   435
#endif
slouken@0
   436
slouken@0
   437
#endif /* _SDL_blit_h */