src/video/SDL_blit_1.c
changeset 1895 c121d94672cb
parent 1402 d910939febfa
child 2257 340942cfda48
     1.1 --- a/src/video/SDL_blit_1.c	Thu Jul 06 18:01:37 2006 +0000
     1.2 +++ b/src/video/SDL_blit_1.c	Mon Jul 10 21:04:37 2006 +0000
     1.3 @@ -28,26 +28,28 @@
     1.4  
     1.5  /* Functions to blit from 8-bit surfaces to other surfaces */
     1.6  
     1.7 -static void Blit1to1(SDL_BlitInfo *info)
     1.8 +static void
     1.9 +Blit1to1(SDL_BlitInfo * info)
    1.10  {
    1.11  #ifndef USE_DUFFS_LOOP
    1.12 -	int c;
    1.13 +    int c;
    1.14  #endif
    1.15 -	int width, height;
    1.16 -	Uint8 *src, *map, *dst;
    1.17 -	int srcskip, dstskip;
    1.18 +    int width, height;
    1.19 +    Uint8 *src, *map, *dst;
    1.20 +    int srcskip, dstskip;
    1.21  
    1.22 -	/* Set up some basic variables */
    1.23 -	width = info->d_width;
    1.24 -	height = info->d_height;
    1.25 -	src = info->s_pixels;
    1.26 -	srcskip = info->s_skip;
    1.27 -	dst = info->d_pixels;
    1.28 -	dstskip = info->d_skip;
    1.29 -	map = info->table;
    1.30 +    /* Set up some basic variables */
    1.31 +    width = info->d_width;
    1.32 +    height = info->d_height;
    1.33 +    src = info->s_pixels;
    1.34 +    srcskip = info->s_skip;
    1.35 +    dst = info->d_pixels;
    1.36 +    dstskip = info->d_skip;
    1.37 +    map = info->table;
    1.38  
    1.39 -	while ( height-- ) {
    1.40 +    while (height--) {
    1.41  #ifdef USE_DUFFS_LOOP
    1.42 +        /* *INDENT-OFF* */
    1.43  		DUFFS_LOOP(
    1.44  			{
    1.45  			  *dst = map[*src];
    1.46 @@ -55,17 +57,19 @@
    1.47  			dst++;
    1.48  			src++;
    1.49  		, width);
    1.50 +        /* *INDENT-ON* */
    1.51  #else
    1.52 -		for ( c=width; c; --c ) {
    1.53 -		        *dst = map[*src];
    1.54 -			dst++;
    1.55 -			src++;
    1.56 -		}
    1.57 +        for (c = width; c; --c) {
    1.58 +            *dst = map[*src];
    1.59 +            dst++;
    1.60 +            src++;
    1.61 +        }
    1.62  #endif
    1.63 -		src += srcskip;
    1.64 -		dst += dstskip;
    1.65 -	}
    1.66 +        src += srcskip;
    1.67 +        dst += dstskip;
    1.68 +    }
    1.69  }
    1.70 +
    1.71  /* This is now endian dependent */
    1.72  #if ( SDL_BYTEORDER == SDL_LIL_ENDIAN )
    1.73  #define HI	1
    1.74 @@ -74,136 +78,135 @@
    1.75  #define HI	0
    1.76  #define LO	1
    1.77  #endif
    1.78 -static void Blit1to2(SDL_BlitInfo *info)
    1.79 +static void
    1.80 +Blit1to2(SDL_BlitInfo * info)
    1.81  {
    1.82  #ifndef USE_DUFFS_LOOP
    1.83 -	int c;
    1.84 +    int c;
    1.85  #endif
    1.86 -	int width, height;
    1.87 -	Uint8 *src, *dst;
    1.88 -	Uint16 *map;
    1.89 -	int srcskip, dstskip;
    1.90 +    int width, height;
    1.91 +    Uint8 *src, *dst;
    1.92 +    Uint16 *map;
    1.93 +    int srcskip, dstskip;
    1.94  
    1.95 -	/* Set up some basic variables */
    1.96 -	width = info->d_width;
    1.97 -	height = info->d_height;
    1.98 -	src = info->s_pixels;
    1.99 -	srcskip = info->s_skip;
   1.100 -	dst = info->d_pixels;
   1.101 -	dstskip = info->d_skip;
   1.102 -	map = (Uint16 *)info->table;
   1.103 +    /* Set up some basic variables */
   1.104 +    width = info->d_width;
   1.105 +    height = info->d_height;
   1.106 +    src = info->s_pixels;
   1.107 +    srcskip = info->s_skip;
   1.108 +    dst = info->d_pixels;
   1.109 +    dstskip = info->d_skip;
   1.110 +    map = (Uint16 *) info->table;
   1.111  
   1.112  #ifdef USE_DUFFS_LOOP
   1.113 -	while ( height-- ) {
   1.114 +    while (height--) {
   1.115 +		/* *INDENT-OFF* */
   1.116  		DUFFS_LOOP(
   1.117  		{
   1.118  			*(Uint16 *)dst = map[*src++];
   1.119  			dst += 2;
   1.120  		},
   1.121  		width);
   1.122 -		src += srcskip;
   1.123 -		dst += dstskip;
   1.124 -	}
   1.125 +		/* *INDENT-ON* */
   1.126 +        src += srcskip;
   1.127 +        dst += dstskip;
   1.128 +    }
   1.129  #else
   1.130 -	/* Memory align at 4-byte boundary, if necessary */
   1.131 -	if ( (long)dst & 0x03 ) {
   1.132 -		/* Don't do anything if width is 0 */
   1.133 -		if ( width == 0 ) {
   1.134 -			return;
   1.135 -		}
   1.136 -		--width;
   1.137 +    /* Memory align at 4-byte boundary, if necessary */
   1.138 +    if ((long) dst & 0x03) {
   1.139 +        /* Don't do anything if width is 0 */
   1.140 +        if (width == 0) {
   1.141 +            return;
   1.142 +        }
   1.143 +        --width;
   1.144  
   1.145 -		while ( height-- ) {
   1.146 -			/* Perform copy alignment */
   1.147 -			*(Uint16 *)dst = map[*src++];
   1.148 -			dst += 2;
   1.149 +        while (height--) {
   1.150 +            /* Perform copy alignment */
   1.151 +            *(Uint16 *) dst = map[*src++];
   1.152 +            dst += 2;
   1.153  
   1.154 -			/* Copy in 4 pixel chunks */
   1.155 -			for ( c=width/4; c; --c ) {
   1.156 -				*(Uint32 *)dst =
   1.157 -					(map[src[HI]]<<16)|(map[src[LO]]);
   1.158 -				src += 2;
   1.159 -				dst += 4;
   1.160 -				*(Uint32 *)dst =
   1.161 -					(map[src[HI]]<<16)|(map[src[LO]]);
   1.162 -				src += 2;
   1.163 -				dst += 4;
   1.164 -			}
   1.165 -			/* Get any leftovers */
   1.166 -			switch (width & 3) {
   1.167 -				case 3:
   1.168 -					*(Uint16 *)dst = map[*src++];
   1.169 -					dst += 2;
   1.170 -				case 2:
   1.171 -					*(Uint32 *)dst =
   1.172 -					  (map[src[HI]]<<16)|(map[src[LO]]);
   1.173 -					src += 2;
   1.174 -					dst += 4;
   1.175 -					break;
   1.176 -				case 1:
   1.177 -					*(Uint16 *)dst = map[*src++];
   1.178 -					dst += 2;
   1.179 -					break;
   1.180 -			}
   1.181 -			src += srcskip;
   1.182 -			dst += dstskip;
   1.183 -		}
   1.184 -	} else { 
   1.185 -		while ( height-- ) {
   1.186 -			/* Copy in 4 pixel chunks */
   1.187 -			for ( c=width/4; c; --c ) {
   1.188 -				*(Uint32 *)dst =
   1.189 -					(map[src[HI]]<<16)|(map[src[LO]]);
   1.190 -				src += 2;
   1.191 -				dst += 4;
   1.192 -				*(Uint32 *)dst =
   1.193 -					(map[src[HI]]<<16)|(map[src[LO]]);
   1.194 -				src += 2;
   1.195 -				dst += 4;
   1.196 -			}
   1.197 -			/* Get any leftovers */
   1.198 -			switch (width & 3) {
   1.199 -				case 3:
   1.200 -					*(Uint16 *)dst = map[*src++];
   1.201 -					dst += 2;
   1.202 -				case 2:
   1.203 -					*(Uint32 *)dst =
   1.204 -					  (map[src[HI]]<<16)|(map[src[LO]]);
   1.205 -					src += 2;
   1.206 -					dst += 4;
   1.207 -					break;
   1.208 -				case 1:
   1.209 -					*(Uint16 *)dst = map[*src++];
   1.210 -					dst += 2;
   1.211 -					break;
   1.212 -			}
   1.213 -			src += srcskip;
   1.214 -			dst += dstskip;
   1.215 -		}
   1.216 -	}
   1.217 +            /* Copy in 4 pixel chunks */
   1.218 +            for (c = width / 4; c; --c) {
   1.219 +                *(Uint32 *) dst = (map[src[HI]] << 16) | (map[src[LO]]);
   1.220 +                src += 2;
   1.221 +                dst += 4;
   1.222 +                *(Uint32 *) dst = (map[src[HI]] << 16) | (map[src[LO]]);
   1.223 +                src += 2;
   1.224 +                dst += 4;
   1.225 +            }
   1.226 +            /* Get any leftovers */
   1.227 +            switch (width & 3) {
   1.228 +            case 3:
   1.229 +                *(Uint16 *) dst = map[*src++];
   1.230 +                dst += 2;
   1.231 +            case 2:
   1.232 +                *(Uint32 *) dst = (map[src[HI]] << 16) | (map[src[LO]]);
   1.233 +                src += 2;
   1.234 +                dst += 4;
   1.235 +                break;
   1.236 +            case 1:
   1.237 +                *(Uint16 *) dst = map[*src++];
   1.238 +                dst += 2;
   1.239 +                break;
   1.240 +            }
   1.241 +            src += srcskip;
   1.242 +            dst += dstskip;
   1.243 +        }
   1.244 +    } else {
   1.245 +        while (height--) {
   1.246 +            /* Copy in 4 pixel chunks */
   1.247 +            for (c = width / 4; c; --c) {
   1.248 +                *(Uint32 *) dst = (map[src[HI]] << 16) | (map[src[LO]]);
   1.249 +                src += 2;
   1.250 +                dst += 4;
   1.251 +                *(Uint32 *) dst = (map[src[HI]] << 16) | (map[src[LO]]);
   1.252 +                src += 2;
   1.253 +                dst += 4;
   1.254 +            }
   1.255 +            /* Get any leftovers */
   1.256 +            switch (width & 3) {
   1.257 +            case 3:
   1.258 +                *(Uint16 *) dst = map[*src++];
   1.259 +                dst += 2;
   1.260 +            case 2:
   1.261 +                *(Uint32 *) dst = (map[src[HI]] << 16) | (map[src[LO]]);
   1.262 +                src += 2;
   1.263 +                dst += 4;
   1.264 +                break;
   1.265 +            case 1:
   1.266 +                *(Uint16 *) dst = map[*src++];
   1.267 +                dst += 2;
   1.268 +                break;
   1.269 +            }
   1.270 +            src += srcskip;
   1.271 +            dst += dstskip;
   1.272 +        }
   1.273 +    }
   1.274  #endif /* USE_DUFFS_LOOP */
   1.275  }
   1.276 -static void Blit1to3(SDL_BlitInfo *info)
   1.277 +static void
   1.278 +Blit1to3(SDL_BlitInfo * info)
   1.279  {
   1.280  #ifndef USE_DUFFS_LOOP
   1.281 -	int c;
   1.282 +    int c;
   1.283  #endif
   1.284 -	int o;
   1.285 -	int width, height;
   1.286 -	Uint8 *src, *map, *dst;
   1.287 -	int srcskip, dstskip;
   1.288 +    int o;
   1.289 +    int width, height;
   1.290 +    Uint8 *src, *map, *dst;
   1.291 +    int srcskip, dstskip;
   1.292  
   1.293 -	/* Set up some basic variables */
   1.294 -	width = info->d_width;
   1.295 -	height = info->d_height;
   1.296 -	src = info->s_pixels;
   1.297 -	srcskip = info->s_skip;
   1.298 -	dst = info->d_pixels;
   1.299 -	dstskip = info->d_skip;
   1.300 -	map = info->table;
   1.301 +    /* Set up some basic variables */
   1.302 +    width = info->d_width;
   1.303 +    height = info->d_height;
   1.304 +    src = info->s_pixels;
   1.305 +    srcskip = info->s_skip;
   1.306 +    dst = info->d_pixels;
   1.307 +    dstskip = info->d_skip;
   1.308 +    map = info->table;
   1.309  
   1.310 -	while ( height-- ) {
   1.311 +    while (height--) {
   1.312  #ifdef USE_DUFFS_LOOP
   1.313 +		/* *INDENT-OFF* */
   1.314  		DUFFS_LOOP(
   1.315  			{
   1.316  				o = *src * 4;
   1.317 @@ -214,78 +217,84 @@
   1.318  			src++;
   1.319  			dst += 3;
   1.320  		, width);
   1.321 +		/* *INDENT-ON* */
   1.322  #else
   1.323 -		for ( c=width; c; --c ) {
   1.324 -			o = *src * 4;
   1.325 -			dst[0] = map[o++];
   1.326 -			dst[1] = map[o++];
   1.327 -			dst[2] = map[o++];
   1.328 -			src++;
   1.329 -			dst += 3;
   1.330 -		}
   1.331 +        for (c = width; c; --c) {
   1.332 +            o = *src * 4;
   1.333 +            dst[0] = map[o++];
   1.334 +            dst[1] = map[o++];
   1.335 +            dst[2] = map[o++];
   1.336 +            src++;
   1.337 +            dst += 3;
   1.338 +        }
   1.339  #endif /* USE_DUFFS_LOOP */
   1.340 -		src += srcskip;
   1.341 -		dst += dstskip;
   1.342 -	}
   1.343 +        src += srcskip;
   1.344 +        dst += dstskip;
   1.345 +    }
   1.346  }
   1.347 -static void Blit1to4(SDL_BlitInfo *info)
   1.348 +static void
   1.349 +Blit1to4(SDL_BlitInfo * info)
   1.350  {
   1.351  #ifndef USE_DUFFS_LOOP
   1.352 -	int c;
   1.353 +    int c;
   1.354  #endif
   1.355 -	int width, height;
   1.356 -	Uint8 *src;
   1.357 -	Uint32 *map, *dst;
   1.358 -	int srcskip, dstskip;
   1.359 +    int width, height;
   1.360 +    Uint8 *src;
   1.361 +    Uint32 *map, *dst;
   1.362 +    int srcskip, dstskip;
   1.363  
   1.364 -	/* Set up some basic variables */
   1.365 -	width = info->d_width;
   1.366 -	height = info->d_height;
   1.367 -	src = info->s_pixels;
   1.368 -	srcskip = info->s_skip;
   1.369 -	dst = (Uint32 *)info->d_pixels;
   1.370 -	dstskip = info->d_skip/4;
   1.371 -	map = (Uint32 *)info->table;
   1.372 +    /* Set up some basic variables */
   1.373 +    width = info->d_width;
   1.374 +    height = info->d_height;
   1.375 +    src = info->s_pixels;
   1.376 +    srcskip = info->s_skip;
   1.377 +    dst = (Uint32 *) info->d_pixels;
   1.378 +    dstskip = info->d_skip / 4;
   1.379 +    map = (Uint32 *) info->table;
   1.380  
   1.381 -	while ( height-- ) {
   1.382 +    while (height--) {
   1.383  #ifdef USE_DUFFS_LOOP
   1.384 +		/* *INDENT-OFF* */
   1.385  		DUFFS_LOOP(
   1.386  			*dst++ = map[*src++];
   1.387  		, width);
   1.388 +		/* *INDENT-ON* */
   1.389  #else
   1.390 -		for ( c=width/4; c; --c ) {
   1.391 -			*dst++ = map[*src++];
   1.392 -			*dst++ = map[*src++];
   1.393 -			*dst++ = map[*src++];
   1.394 -			*dst++ = map[*src++];
   1.395 -		}
   1.396 -		switch ( width & 3 ) {
   1.397 -			case 3:
   1.398 -				*dst++ = map[*src++];
   1.399 -			case 2:
   1.400 -				*dst++ = map[*src++];
   1.401 -			case 1:
   1.402 -				*dst++ = map[*src++];
   1.403 -		}
   1.404 +        for (c = width / 4; c; --c) {
   1.405 +            *dst++ = map[*src++];
   1.406 +            *dst++ = map[*src++];
   1.407 +            *dst++ = map[*src++];
   1.408 +            *dst++ = map[*src++];
   1.409 +        }
   1.410 +        switch (width & 3) {
   1.411 +        case 3:
   1.412 +            *dst++ = map[*src++];
   1.413 +        case 2:
   1.414 +            *dst++ = map[*src++];
   1.415 +        case 1:
   1.416 +            *dst++ = map[*src++];
   1.417 +        }
   1.418  #endif /* USE_DUFFS_LOOP */
   1.419 -		src += srcskip;
   1.420 -		dst += dstskip;
   1.421 -	}
   1.422 +        src += srcskip;
   1.423 +        dst += dstskip;
   1.424 +    }
   1.425  }
   1.426  
   1.427 -static void Blit1to1Key(SDL_BlitInfo *info)
   1.428 +static void
   1.429 +Blit1to1Key(SDL_BlitInfo * info)
   1.430  {
   1.431 -	int width = info->d_width;
   1.432 -	int height = info->d_height;
   1.433 -	Uint8 *src = info->s_pixels;
   1.434 -	int srcskip = info->s_skip;
   1.435 -	Uint8 *dst = info->d_pixels;
   1.436 -	int dstskip = info->d_skip;
   1.437 -	Uint8 *palmap = info->table;
   1.438 -	Uint32 ckey = info->src->colorkey;
   1.439 -        
   1.440 -	if ( palmap ) {
   1.441 -		while ( height-- ) {
   1.442 +    int width = info->d_width;
   1.443 +    int height = info->d_height;
   1.444 +    Uint8 *src = info->s_pixels;
   1.445 +    int srcskip = info->s_skip;
   1.446 +    Uint8 *dst = info->d_pixels;
   1.447 +    int dstskip = info->d_skip;
   1.448 +    Uint8 *palmap = info->table;
   1.449 +    Uint32 ckey = info->src->colorkey;
   1.450 +
   1.451 +    if (palmap) {
   1.452 +        while (height--) {
   1.453 +			/* *INDENT-OFF* */
   1.454  			DUFFS_LOOP(
   1.455  			{
   1.456  				if ( *src != ckey ) {
   1.457 @@ -295,11 +304,13 @@
   1.458  				src++;
   1.459  			},
   1.460  			width);
   1.461 -			src += srcskip;
   1.462 -			dst += dstskip;
   1.463 -		}
   1.464 -	} else {
   1.465 -		while ( height-- ) {
   1.466 +			/* *INDENT-ON* */
   1.467 +            src += srcskip;
   1.468 +            dst += dstskip;
   1.469 +        }
   1.470 +    } else {
   1.471 +        while (height--) {
   1.472 +			/* *INDENT-OFF* */
   1.473  			DUFFS_LOOP(
   1.474  			{
   1.475  				if ( *src != ckey ) {
   1.476 @@ -309,27 +320,30 @@
   1.477  				src++;
   1.478  			},
   1.479  			width);
   1.480 -			src += srcskip;
   1.481 -			dst += dstskip;
   1.482 -		}
   1.483 -	}
   1.484 +			/* *INDENT-ON* */
   1.485 +            src += srcskip;
   1.486 +            dst += dstskip;
   1.487 +        }
   1.488 +    }
   1.489  }
   1.490  
   1.491 -static void Blit1to2Key(SDL_BlitInfo *info)
   1.492 +static void
   1.493 +Blit1to2Key(SDL_BlitInfo * info)
   1.494  {
   1.495 -	int width = info->d_width;
   1.496 -	int height = info->d_height;
   1.497 -	Uint8 *src = info->s_pixels;
   1.498 -	int srcskip = info->s_skip;
   1.499 -	Uint16 *dstp = (Uint16 *)info->d_pixels;
   1.500 -	int dstskip = info->d_skip;
   1.501 -	Uint16 *palmap = (Uint16 *)info->table;
   1.502 -	Uint32 ckey = info->src->colorkey;
   1.503 +    int width = info->d_width;
   1.504 +    int height = info->d_height;
   1.505 +    Uint8 *src = info->s_pixels;
   1.506 +    int srcskip = info->s_skip;
   1.507 +    Uint16 *dstp = (Uint16 *) info->d_pixels;
   1.508 +    int dstskip = info->d_skip;
   1.509 +    Uint16 *palmap = (Uint16 *) info->table;
   1.510 +    Uint32 ckey = info->src->colorkey;
   1.511  
   1.512 -	/* Set up some basic variables */
   1.513 -	dstskip /= 2;
   1.514 +    /* Set up some basic variables */
   1.515 +    dstskip /= 2;
   1.516  
   1.517 -	while ( height-- ) {
   1.518 +    while (height--) {
   1.519 +		/* *INDENT-OFF* */
   1.520  		DUFFS_LOOP(
   1.521  		{
   1.522  			if ( *src != ckey ) {
   1.523 @@ -339,24 +353,27 @@
   1.524  			dstp++;
   1.525  		},
   1.526  		width);
   1.527 -		src += srcskip;
   1.528 -		dstp += dstskip;
   1.529 -	}
   1.530 +		/* *INDENT-ON* */
   1.531 +        src += srcskip;
   1.532 +        dstp += dstskip;
   1.533 +    }
   1.534  }
   1.535  
   1.536 -static void Blit1to3Key(SDL_BlitInfo *info)
   1.537 +static void
   1.538 +Blit1to3Key(SDL_BlitInfo * info)
   1.539  {
   1.540 -	int width = info->d_width;
   1.541 -	int height = info->d_height;
   1.542 -	Uint8 *src = info->s_pixels;
   1.543 -	int srcskip = info->s_skip;
   1.544 -	Uint8 *dst = info->d_pixels;
   1.545 -	int dstskip = info->d_skip;
   1.546 -	Uint8 *palmap = info->table;
   1.547 -	Uint32 ckey = info->src->colorkey;
   1.548 -	int o;
   1.549 +    int width = info->d_width;
   1.550 +    int height = info->d_height;
   1.551 +    Uint8 *src = info->s_pixels;
   1.552 +    int srcskip = info->s_skip;
   1.553 +    Uint8 *dst = info->d_pixels;
   1.554 +    int dstskip = info->d_skip;
   1.555 +    Uint8 *palmap = info->table;
   1.556 +    Uint32 ckey = info->src->colorkey;
   1.557 +    int o;
   1.558  
   1.559 -	while ( height-- ) {
   1.560 +    while (height--) {
   1.561 +		/* *INDENT-OFF* */
   1.562  		DUFFS_LOOP(
   1.563  		{
   1.564  			if ( *src != ckey ) {
   1.565 @@ -369,26 +386,29 @@
   1.566  			dst += 3;
   1.567  		},
   1.568  		width);
   1.569 -		src += srcskip;
   1.570 -		dst += dstskip;
   1.571 -	}
   1.572 +		/* *INDENT-ON* */
   1.573 +        src += srcskip;
   1.574 +        dst += dstskip;
   1.575 +    }
   1.576  }
   1.577  
   1.578 -static void Blit1to4Key(SDL_BlitInfo *info)
   1.579 +static void
   1.580 +Blit1to4Key(SDL_BlitInfo * info)
   1.581  {
   1.582 -	int width = info->d_width;
   1.583 -	int height = info->d_height;
   1.584 -	Uint8 *src = info->s_pixels;
   1.585 -	int srcskip = info->s_skip;
   1.586 -	Uint32 *dstp = (Uint32 *)info->d_pixels;
   1.587 -	int dstskip = info->d_skip;
   1.588 -	Uint32 *palmap = (Uint32 *)info->table;
   1.589 -	Uint32 ckey = info->src->colorkey;
   1.590 +    int width = info->d_width;
   1.591 +    int height = info->d_height;
   1.592 +    Uint8 *src = info->s_pixels;
   1.593 +    int srcskip = info->s_skip;
   1.594 +    Uint32 *dstp = (Uint32 *) info->d_pixels;
   1.595 +    int dstskip = info->d_skip;
   1.596 +    Uint32 *palmap = (Uint32 *) info->table;
   1.597 +    Uint32 ckey = info->src->colorkey;
   1.598  
   1.599 -	/* Set up some basic variables */
   1.600 -	dstskip /= 4;
   1.601 +    /* Set up some basic variables */
   1.602 +    dstskip /= 4;
   1.603  
   1.604 -	while ( height-- ) {
   1.605 +    while (height--) {
   1.606 +		/* *INDENT-OFF* */
   1.607  		DUFFS_LOOP(
   1.608  		{
   1.609  			if ( *src != ckey ) {
   1.610 @@ -398,30 +418,33 @@
   1.611  			dstp++;
   1.612  		},
   1.613  		width);
   1.614 -		src += srcskip;
   1.615 -		dstp += dstskip;
   1.616 -	}
   1.617 +		/* *INDENT-ON* */
   1.618 +        src += srcskip;
   1.619 +        dstp += dstskip;
   1.620 +    }
   1.621  }
   1.622  
   1.623 -static void Blit1toNAlpha(SDL_BlitInfo *info)
   1.624 +static void
   1.625 +Blit1toNAlpha(SDL_BlitInfo * info)
   1.626  {
   1.627 -	int width = info->d_width;
   1.628 -	int height = info->d_height;
   1.629 -	Uint8 *src = info->s_pixels;
   1.630 -	int srcskip = info->s_skip;
   1.631 -	Uint8 *dst = info->d_pixels;
   1.632 -	int dstskip = info->d_skip;
   1.633 -	SDL_PixelFormat *dstfmt = info->dst;
   1.634 -	const SDL_Color *srcpal	= info->src->palette->colors;
   1.635 -	int dstbpp;
   1.636 -	const int A = info->src->alpha;
   1.637 +    int width = info->d_width;
   1.638 +    int height = info->d_height;
   1.639 +    Uint8 *src = info->s_pixels;
   1.640 +    int srcskip = info->s_skip;
   1.641 +    Uint8 *dst = info->d_pixels;
   1.642 +    int dstskip = info->d_skip;
   1.643 +    SDL_PixelFormat *dstfmt = info->dst;
   1.644 +    const SDL_Color *srcpal = info->src->palette->colors;
   1.645 +    int dstbpp;
   1.646 +    const int A = info->src->alpha;
   1.647  
   1.648 -	/* Set up some basic variables */
   1.649 -	dstbpp = dstfmt->BytesPerPixel;
   1.650 +    /* Set up some basic variables */
   1.651 +    dstbpp = dstfmt->BytesPerPixel;
   1.652  
   1.653 -	while ( height-- ) {
   1.654 -	        int sR, sG, sB;
   1.655 -		int dR, dG, dB;
   1.656 +    while (height--) {
   1.657 +        int sR, sG, sB;
   1.658 +        int dR, dG, dB;
   1.659 +	    	/* *INDENT-OFF* */
   1.660  	    	DUFFS_LOOP4(
   1.661  			{
   1.662  			        Uint32 pixel;
   1.663 @@ -436,32 +459,35 @@
   1.664  				dst += dstbpp;
   1.665  			},
   1.666  			width);
   1.667 -		src += srcskip;
   1.668 -		dst += dstskip;
   1.669 -	}
   1.670 +	    	/* *INDENT-ON* */
   1.671 +        src += srcskip;
   1.672 +        dst += dstskip;
   1.673 +    }
   1.674  }
   1.675  
   1.676 -static void Blit1toNAlphaKey(SDL_BlitInfo *info)
   1.677 +static void
   1.678 +Blit1toNAlphaKey(SDL_BlitInfo * info)
   1.679  {
   1.680 -	int width = info->d_width;
   1.681 -	int height = info->d_height;
   1.682 -	Uint8 *src = info->s_pixels;
   1.683 -	int srcskip = info->s_skip;
   1.684 -	Uint8 *dst = info->d_pixels;
   1.685 -	int dstskip = info->d_skip;
   1.686 -	SDL_PixelFormat *srcfmt = info->src;
   1.687 -	SDL_PixelFormat *dstfmt = info->dst;
   1.688 -	const SDL_Color *srcpal	= info->src->palette->colors;
   1.689 -	Uint32 ckey = srcfmt->colorkey;
   1.690 -	int dstbpp;
   1.691 -	const int A = srcfmt->alpha;
   1.692 +    int width = info->d_width;
   1.693 +    int height = info->d_height;
   1.694 +    Uint8 *src = info->s_pixels;
   1.695 +    int srcskip = info->s_skip;
   1.696 +    Uint8 *dst = info->d_pixels;
   1.697 +    int dstskip = info->d_skip;
   1.698 +    SDL_PixelFormat *srcfmt = info->src;
   1.699 +    SDL_PixelFormat *dstfmt = info->dst;
   1.700 +    const SDL_Color *srcpal = info->src->palette->colors;
   1.701 +    Uint32 ckey = srcfmt->colorkey;
   1.702 +    int dstbpp;
   1.703 +    const int A = srcfmt->alpha;
   1.704  
   1.705 -	/* Set up some basic variables */
   1.706 -	dstbpp = dstfmt->BytesPerPixel;
   1.707 +    /* Set up some basic variables */
   1.708 +    dstbpp = dstfmt->BytesPerPixel;
   1.709  
   1.710 -	while ( height-- ) {
   1.711 -	        int sR, sG, sB;
   1.712 -		int dR, dG, dB;
   1.713 +    while (height--) {
   1.714 +        int sR, sG, sB;
   1.715 +        int dR, dG, dB;
   1.716 +		/* *INDENT-OFF* */
   1.717  		DUFFS_LOOP(
   1.718  		{
   1.719  			if ( *src != ckey ) {
   1.720 @@ -478,46 +504,50 @@
   1.721  			dst += dstbpp;
   1.722  		},
   1.723  		width);
   1.724 -		src += srcskip;
   1.725 -		dst += dstskip;
   1.726 -	}
   1.727 +		/* *INDENT-ON* */
   1.728 +        src += srcskip;
   1.729 +        dst += dstskip;
   1.730 +    }
   1.731  }
   1.732  
   1.733  static SDL_loblit one_blit[] = {
   1.734 -	NULL, Blit1to1, Blit1to2, Blit1to3, Blit1to4
   1.735 +    NULL, Blit1to1, Blit1to2, Blit1to3, Blit1to4
   1.736  };
   1.737  
   1.738  static SDL_loblit one_blitkey[] = {
   1.739 -        NULL, Blit1to1Key, Blit1to2Key, Blit1to3Key, Blit1to4Key
   1.740 +    NULL, Blit1to1Key, Blit1to2Key, Blit1to3Key, Blit1to4Key
   1.741  };
   1.742  
   1.743 -SDL_loblit SDL_CalculateBlit1(SDL_Surface *surface, int blit_index)
   1.744 +SDL_loblit
   1.745 +SDL_CalculateBlit1(SDL_Surface * surface, int blit_index)
   1.746  {
   1.747 -	int which;
   1.748 -	SDL_PixelFormat *dstfmt;
   1.749 +    int which;
   1.750 +    SDL_PixelFormat *dstfmt;
   1.751  
   1.752 -	dstfmt = surface->map->dst->format;
   1.753 -	if ( dstfmt->BitsPerPixel < 8 ) {
   1.754 -		which = 0;
   1.755 -	} else {
   1.756 -		which = dstfmt->BytesPerPixel;
   1.757 -	}
   1.758 -	switch(blit_index) {
   1.759 -	case 0:			/* copy */
   1.760 -	    return one_blit[which];
   1.761 +    dstfmt = surface->map->dst->format;
   1.762 +    if (dstfmt->BitsPerPixel < 8) {
   1.763 +        which = 0;
   1.764 +    } else {
   1.765 +        which = dstfmt->BytesPerPixel;
   1.766 +    }
   1.767 +    switch (blit_index) {
   1.768 +    case 0:                    /* copy */
   1.769 +        return one_blit[which];
   1.770  
   1.771 -	case 1:			/* colorkey */
   1.772 -	    return one_blitkey[which];
   1.773 +    case 1:                    /* colorkey */
   1.774 +        return one_blitkey[which];
   1.775  
   1.776 -	case 2:			/* alpha */
   1.777 -	    /* Supporting 8bpp->8bpp alpha is doable but requires lots of
   1.778 -	       tables which consume space and takes time to precompute,
   1.779 -	       so is better left to the user */
   1.780 -	    return which >= 2 ? Blit1toNAlpha : NULL;
   1.781 +    case 2:                    /* alpha */
   1.782 +        /* Supporting 8bpp->8bpp alpha is doable but requires lots of
   1.783 +           tables which consume space and takes time to precompute,
   1.784 +           so is better left to the user */
   1.785 +        return which >= 2 ? Blit1toNAlpha : NULL;
   1.786  
   1.787 -	case 3:			/* alpha + colorkey */
   1.788 -	    return which >= 2 ? Blit1toNAlphaKey : NULL;
   1.789 +    case 3:                    /* alpha + colorkey */
   1.790 +        return which >= 2 ? Blit1toNAlphaKey : NULL;
   1.791  
   1.792 -	}
   1.793 -	return NULL;
   1.794 +    }
   1.795 +    return NULL;
   1.796  }
   1.797 +
   1.798 +/* vi: set ts=4 sw=4 expandtab: */