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