src/video/SDL_surface.c
changeset 2786 6bacfecbf27e
parent 2785 fa1095d42a5b
child 2787 93764fe8601a
     1.1 --- a/src/video/SDL_surface.c	Tue Nov 25 02:12:19 2008 +0000
     1.2 +++ b/src/video/SDL_surface.c	Tue Nov 25 02:21:53 2008 +0000
     1.3 @@ -271,68 +271,68 @@
     1.4  
     1.5  /* This is a fairly slow function to switch from colorkey to alpha */
     1.6  void
     1.7 -SDL_ConvertColorkeyToAlpha(SDL_Surface *surface)
     1.8 +SDL_ConvertColorkeyToAlpha(SDL_Surface * surface)
     1.9  {
    1.10 -	int x, y;
    1.11 +    int x, y;
    1.12  
    1.13 -	if (!surface) {
    1.14 -		return;
    1.15 -	}
    1.16 +    if (!surface) {
    1.17 +        return;
    1.18 +    }
    1.19  
    1.20 -	if (!(surface->map->info.flags & SDL_COPY_COLORKEY) ||
    1.21 -	    !surface->format->Amask) {
    1.22 -		return;
    1.23 -	}
    1.24 +    if (!(surface->map->info.flags & SDL_COPY_COLORKEY) ||
    1.25 +        !surface->format->Amask) {
    1.26 +        return;
    1.27 +    }
    1.28  
    1.29 -	SDL_LockSurface(surface);
    1.30 +    SDL_LockSurface(surface);
    1.31  
    1.32 -	switch (surface->format->BytesPerPixel) {
    1.33 -	case 2:
    1.34 -		{
    1.35 -			Uint16 *row, *spot;
    1.36 -			Uint16 ckey = (Uint16)surface->map->info.colorkey;
    1.37 -			Uint16 mask = (Uint16)(~surface->format->Amask);
    1.38 +    switch (surface->format->BytesPerPixel) {
    1.39 +    case 2:
    1.40 +        {
    1.41 +            Uint16 *row, *spot;
    1.42 +            Uint16 ckey = (Uint16) surface->map->info.colorkey;
    1.43 +            Uint16 mask = (Uint16) (~surface->format->Amask);
    1.44  
    1.45 -			row = (Uint16 *)surface->pixels;
    1.46 -			for (y = surface->h; y--; ) {
    1.47 -				spot = row;
    1.48 -				for (x = surface->w; x--; ) {
    1.49 -					if (*spot == ckey) {
    1.50 -						*spot &= mask;
    1.51 -					}
    1.52 -					++spot;
    1.53 -				}
    1.54 -				row += surface->pitch / 2;
    1.55 -			}
    1.56 -		}
    1.57 -		break;
    1.58 -	case 3:
    1.59 -		/* FIXME */
    1.60 -		break;
    1.61 -	case 4:
    1.62 -		{
    1.63 -			Uint32 *row, *spot;
    1.64 -			Uint32 ckey = surface->map->info.colorkey;
    1.65 -			Uint32 mask = ~surface->format->Amask;
    1.66 +            row = (Uint16 *) surface->pixels;
    1.67 +            for (y = surface->h; y--;) {
    1.68 +                spot = row;
    1.69 +                for (x = surface->w; x--;) {
    1.70 +                    if (*spot == ckey) {
    1.71 +                        *spot &= mask;
    1.72 +                    }
    1.73 +                    ++spot;
    1.74 +                }
    1.75 +                row += surface->pitch / 2;
    1.76 +            }
    1.77 +        }
    1.78 +        break;
    1.79 +    case 3:
    1.80 +        /* FIXME */
    1.81 +        break;
    1.82 +    case 4:
    1.83 +        {
    1.84 +            Uint32 *row, *spot;
    1.85 +            Uint32 ckey = surface->map->info.colorkey;
    1.86 +            Uint32 mask = ~surface->format->Amask;
    1.87  
    1.88 -			row = (Uint32 *)surface->pixels;
    1.89 -			for (y = surface->h; y--; ) {
    1.90 -				spot = row;
    1.91 -				for (x = surface->w; x--; ) {
    1.92 -					if (*spot == ckey) {
    1.93 -						*spot &= mask;
    1.94 -					}
    1.95 -					++spot;
    1.96 -				}
    1.97 -				row += surface->pitch / 4;
    1.98 -			}
    1.99 -		}
   1.100 -		break;
   1.101 -	}
   1.102 +            row = (Uint32 *) surface->pixels;
   1.103 +            for (y = surface->h; y--;) {
   1.104 +                spot = row;
   1.105 +                for (x = surface->w; x--;) {
   1.106 +                    if (*spot == ckey) {
   1.107 +                        *spot &= mask;
   1.108 +                    }
   1.109 +                    ++spot;
   1.110 +                }
   1.111 +                row += surface->pitch / 4;
   1.112 +            }
   1.113 +        }
   1.114 +        break;
   1.115 +    }
   1.116  
   1.117 -	SDL_UnlockSurface(surface);
   1.118 +    SDL_UnlockSurface(surface);
   1.119  
   1.120 -	SDL_SetColorKey(surface, 0, 0);
   1.121 +    SDL_SetColorKey(surface, 0, 0);
   1.122  }
   1.123  
   1.124  int