src/video/SDL_RLEaccel.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
child 1683 396a35389351
     1.1 --- a/src/video/SDL_RLEaccel.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/video/SDL_RLEaccel.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -780,8 +780,8 @@
     1.4   * right. Top clipping has already been taken care of.
     1.5   */
     1.6  static void
     1.7 -RLEClipBlit (int w, Uint8 * srcbuf, SDL_Surface * dst,
     1.8 -             Uint8 * dstbuf, SDL_Rect * srcrect, unsigned alpha)
     1.9 +RLEClipBlit(int w, Uint8 * srcbuf, SDL_Surface * dst,
    1.10 +            Uint8 * dstbuf, SDL_Rect * srcrect, unsigned alpha)
    1.11  {
    1.12      SDL_PixelFormat *fmt = dst->format;
    1.13  
    1.14 @@ -829,7 +829,7 @@
    1.15  	}								   \
    1.16      } while(0)
    1.17  
    1.18 -    CHOOSE_BLIT (RLECLIPBLIT, alpha, fmt);
    1.19 +    CHOOSE_BLIT(RLECLIPBLIT, alpha, fmt);
    1.20  
    1.21  #undef RLECLIPBLIT
    1.22  
    1.23 @@ -838,8 +838,8 @@
    1.24  
    1.25  /* blit a colorkeyed RLE surface */
    1.26  int
    1.27 -SDL_RLEBlit (SDL_Surface * src, SDL_Rect * srcrect,
    1.28 -             SDL_Surface * dst, SDL_Rect * dstrect)
    1.29 +SDL_RLEBlit(SDL_Surface * src, SDL_Rect * srcrect,
    1.30 +            SDL_Surface * dst, SDL_Rect * dstrect)
    1.31  {
    1.32      Uint8 *dstbuf;
    1.33      Uint8 *srcbuf;
    1.34 @@ -848,8 +848,8 @@
    1.35      unsigned alpha;
    1.36  
    1.37      /* Lock the destination if necessary */
    1.38 -    if (SDL_MUSTLOCK (dst)) {
    1.39 -        if (SDL_LockSurface (dst) < 0) {
    1.40 +    if (SDL_MUSTLOCK(dst)) {
    1.41 +        if (SDL_LockSurface(dst) < 0) {
    1.42              return (-1);
    1.43          }
    1.44      }
    1.45 @@ -887,16 +887,16 @@
    1.46  
    1.47              switch (src->format->BytesPerPixel) {
    1.48              case 1:
    1.49 -                RLESKIP (1, Uint8);
    1.50 +                RLESKIP(1, Uint8);
    1.51                  break;
    1.52              case 2:
    1.53 -                RLESKIP (2, Uint8);
    1.54 +                RLESKIP(2, Uint8);
    1.55                  break;
    1.56              case 3:
    1.57 -                RLESKIP (3, Uint8);
    1.58 +                RLESKIP(3, Uint8);
    1.59                  break;
    1.60              case 4:
    1.61 -                RLESKIP (4, Uint16);
    1.62 +                RLESKIP(4, Uint16);
    1.63                  break;
    1.64              }
    1.65  
    1.66 @@ -909,7 +909,7 @@
    1.67          ? src->format->alpha : 255;
    1.68      /* if left or right edge clipping needed, call clip blit */
    1.69      if (srcrect->x || srcrect->w != src->w) {
    1.70 -        RLEClipBlit (w, srcbuf, dst, dstbuf, srcrect, alpha);
    1.71 +        RLEClipBlit(w, srcbuf, dst, dstbuf, srcrect, alpha);
    1.72      } else {
    1.73          SDL_PixelFormat *fmt = src->format;
    1.74  
    1.75 @@ -937,15 +937,15 @@
    1.76  		}							      \
    1.77  	    } while(0)
    1.78  
    1.79 -        CHOOSE_BLIT (RLEBLIT, alpha, fmt);
    1.80 +        CHOOSE_BLIT(RLEBLIT, alpha, fmt);
    1.81  
    1.82  #undef RLEBLIT
    1.83      }
    1.84  
    1.85    done:
    1.86      /* Unlock the destination if necessary */
    1.87 -    if (SDL_MUSTLOCK (dst)) {
    1.88 -        SDL_UnlockSurface (dst);
    1.89 +    if (SDL_MUSTLOCK(dst)) {
    1.90 +        SDL_UnlockSurface(dst);
    1.91      }
    1.92      return (0);
    1.93  }
    1.94 @@ -1023,8 +1023,8 @@
    1.95  
    1.96  /* blit a pixel-alpha RLE surface clipped at the right and/or left edges */
    1.97  static void
    1.98 -RLEAlphaClipBlit (int w, Uint8 * srcbuf, SDL_Surface * dst,
    1.99 -                  Uint8 * dstbuf, SDL_Rect * srcrect)
   1.100 +RLEAlphaClipBlit(int w, Uint8 * srcbuf, SDL_Surface * dst,
   1.101 +                 Uint8 * dstbuf, SDL_Rect * srcrect)
   1.102  {
   1.103      SDL_PixelFormat *df = dst->format;
   1.104      /*
   1.105 @@ -1103,20 +1103,20 @@
   1.106      switch (df->BytesPerPixel) {
   1.107      case 2:
   1.108          if (df->Gmask == 0x07e0 || df->Rmask == 0x07e0 || df->Bmask == 0x07e0)
   1.109 -            RLEALPHACLIPBLIT (Uint16, Uint8, BLIT_TRANSL_565);
   1.110 +            RLEALPHACLIPBLIT(Uint16, Uint8, BLIT_TRANSL_565);
   1.111          else
   1.112 -            RLEALPHACLIPBLIT (Uint16, Uint8, BLIT_TRANSL_555);
   1.113 +            RLEALPHACLIPBLIT(Uint16, Uint8, BLIT_TRANSL_555);
   1.114          break;
   1.115      case 4:
   1.116 -        RLEALPHACLIPBLIT (Uint32, Uint16, BLIT_TRANSL_888);
   1.117 +        RLEALPHACLIPBLIT(Uint32, Uint16, BLIT_TRANSL_888);
   1.118          break;
   1.119      }
   1.120  }
   1.121  
   1.122  /* blit a pixel-alpha RLE surface */
   1.123  int
   1.124 -SDL_RLEAlphaBlit (SDL_Surface * src, SDL_Rect * srcrect,
   1.125 -                  SDL_Surface * dst, SDL_Rect * dstrect)
   1.126 +SDL_RLEAlphaBlit(SDL_Surface * src, SDL_Rect * srcrect,
   1.127 +                 SDL_Surface * dst, SDL_Rect * dstrect)
   1.128  {
   1.129      int x, y;
   1.130      int w = src->w;
   1.131 @@ -1124,8 +1124,8 @@
   1.132      SDL_PixelFormat *df = dst->format;
   1.133  
   1.134      /* Lock the destination if necessary */
   1.135 -    if (SDL_MUSTLOCK (dst)) {
   1.136 -        if (SDL_LockSurface (dst) < 0) {
   1.137 +    if (SDL_MUSTLOCK(dst)) {
   1.138 +        if (SDL_LockSurface(dst) < 0) {
   1.139              return -1;
   1.140          }
   1.141      }
   1.142 @@ -1133,7 +1133,7 @@
   1.143      x = dstrect->x;
   1.144      y = dstrect->y;
   1.145      dstbuf = (Uint8 *) dst->pixels + y * dst->pitch + x * df->BytesPerPixel;
   1.146 -    srcbuf = (Uint8 *) src->map->sw_data->aux_data + sizeof (RLEDestFormat);
   1.147 +    srcbuf = (Uint8 *) src->map->sw_data->aux_data + sizeof(RLEDestFormat);
   1.148  
   1.149      {
   1.150          /* skip lines at the top if necessary */
   1.151 @@ -1198,7 +1198,7 @@
   1.152  
   1.153      /* if left or right edge clipping needed, call clip blit */
   1.154      if (srcrect->x || srcrect->w != src->w) {
   1.155 -        RLEAlphaClipBlit (w, srcbuf, dst, dstbuf, srcrect);
   1.156 +        RLEAlphaClipBlit(w, srcbuf, dst, dstbuf, srcrect);
   1.157      } else {
   1.158  
   1.159          /*
   1.160 @@ -1255,20 +1255,20 @@
   1.161          case 2:
   1.162              if (df->Gmask == 0x07e0 || df->Rmask == 0x07e0
   1.163                  || df->Bmask == 0x07e0)
   1.164 -                RLEALPHABLIT (Uint16, Uint8, BLIT_TRANSL_565);
   1.165 +                RLEALPHABLIT(Uint16, Uint8, BLIT_TRANSL_565);
   1.166              else
   1.167 -                RLEALPHABLIT (Uint16, Uint8, BLIT_TRANSL_555);
   1.168 +                RLEALPHABLIT(Uint16, Uint8, BLIT_TRANSL_555);
   1.169              break;
   1.170          case 4:
   1.171 -            RLEALPHABLIT (Uint32, Uint16, BLIT_TRANSL_888);
   1.172 +            RLEALPHABLIT(Uint32, Uint16, BLIT_TRANSL_888);
   1.173              break;
   1.174          }
   1.175      }
   1.176  
   1.177    done:
   1.178      /* Unlock the destination if necessary */
   1.179 -    if (SDL_MUSTLOCK (dst)) {
   1.180 -        SDL_UnlockSurface (dst);
   1.181 +    if (SDL_MUSTLOCK(dst)) {
   1.182 +        SDL_UnlockSurface(dst);
   1.183      }
   1.184      return 0;
   1.185  }
   1.186 @@ -1285,15 +1285,15 @@
   1.187  
   1.188  /* encode 32bpp rgb + a into 16bpp rgb, losing alpha */
   1.189  static int
   1.190 -copy_opaque_16 (void *dst, Uint32 * src, int n,
   1.191 -                SDL_PixelFormat * sfmt, SDL_PixelFormat * dfmt)
   1.192 +copy_opaque_16(void *dst, Uint32 * src, int n,
   1.193 +               SDL_PixelFormat * sfmt, SDL_PixelFormat * dfmt)
   1.194  {
   1.195      int i;
   1.196      Uint16 *d = dst;
   1.197      for (i = 0; i < n; i++) {
   1.198          unsigned r, g, b;
   1.199 -        RGB_FROM_PIXEL (*src, sfmt, r, g, b);
   1.200 -        PIXEL_FROM_RGB (*d, dfmt, r, g, b);
   1.201 +        RGB_FROM_PIXEL(*src, sfmt, r, g, b);
   1.202 +        PIXEL_FROM_RGB(*d, dfmt, r, g, b);
   1.203          src++;
   1.204          d++;
   1.205      }
   1.206 @@ -1302,16 +1302,16 @@
   1.207  
   1.208  /* decode opaque pixels from 16bpp to 32bpp rgb + a */
   1.209  static int
   1.210 -uncopy_opaque_16 (Uint32 * dst, void *src, int n,
   1.211 -                  RLEDestFormat * sfmt, SDL_PixelFormat * dfmt)
   1.212 +uncopy_opaque_16(Uint32 * dst, void *src, int n,
   1.213 +                 RLEDestFormat * sfmt, SDL_PixelFormat * dfmt)
   1.214  {
   1.215      int i;
   1.216      Uint16 *s = src;
   1.217      unsigned alpha = dfmt->Amask ? 255 : 0;
   1.218      for (i = 0; i < n; i++) {
   1.219          unsigned r, g, b;
   1.220 -        RGB_FROM_PIXEL (*s, sfmt, r, g, b);
   1.221 -        PIXEL_FROM_RGBA (*dst, dfmt, r, g, b, alpha);
   1.222 +        RGB_FROM_PIXEL(*s, sfmt, r, g, b);
   1.223 +        PIXEL_FROM_RGBA(*dst, dfmt, r, g, b, alpha);
   1.224          s++;
   1.225          dst++;
   1.226      }
   1.227 @@ -1322,16 +1322,16 @@
   1.228  
   1.229  /* encode 32bpp rgb + a into 32bpp G0RAB format for blitting into 565 */
   1.230  static int
   1.231 -copy_transl_565 (void *dst, Uint32 * src, int n,
   1.232 -                 SDL_PixelFormat * sfmt, SDL_PixelFormat * dfmt)
   1.233 +copy_transl_565(void *dst, Uint32 * src, int n,
   1.234 +                SDL_PixelFormat * sfmt, SDL_PixelFormat * dfmt)
   1.235  {
   1.236      int i;
   1.237      Uint32 *d = dst;
   1.238      for (i = 0; i < n; i++) {
   1.239          unsigned r, g, b, a;
   1.240          Uint16 pix;
   1.241 -        RGBA_FROM_8888 (*src, sfmt, r, g, b, a);
   1.242 -        PIXEL_FROM_RGB (pix, dfmt, r, g, b);
   1.243 +        RGBA_FROM_8888(*src, sfmt, r, g, b, a);
   1.244 +        PIXEL_FROM_RGB(pix, dfmt, r, g, b);
   1.245          *d = ((pix & 0x7e0) << 16) | (pix & 0xf81f) | ((a << 2) & 0x7e0);
   1.246          src++;
   1.247          d++;
   1.248 @@ -1341,16 +1341,16 @@
   1.249  
   1.250  /* encode 32bpp rgb + a into 32bpp G0RAB format for blitting into 555 */
   1.251  static int
   1.252 -copy_transl_555 (void *dst, Uint32 * src, int n,
   1.253 -                 SDL_PixelFormat * sfmt, SDL_PixelFormat * dfmt)
   1.254 +copy_transl_555(void *dst, Uint32 * src, int n,
   1.255 +                SDL_PixelFormat * sfmt, SDL_PixelFormat * dfmt)
   1.256  {
   1.257      int i;
   1.258      Uint32 *d = dst;
   1.259      for (i = 0; i < n; i++) {
   1.260          unsigned r, g, b, a;
   1.261          Uint16 pix;
   1.262 -        RGBA_FROM_8888 (*src, sfmt, r, g, b, a);
   1.263 -        PIXEL_FROM_RGB (pix, dfmt, r, g, b);
   1.264 +        RGBA_FROM_8888(*src, sfmt, r, g, b, a);
   1.265 +        PIXEL_FROM_RGB(pix, dfmt, r, g, b);
   1.266          *d = ((pix & 0x3e0) << 16) | (pix & 0xfc1f) | ((a << 2) & 0x3e0);
   1.267          src++;
   1.268          d++;
   1.269 @@ -1360,8 +1360,8 @@
   1.270  
   1.271  /* decode translucent pixels from 32bpp GORAB to 32bpp rgb + a */
   1.272  static int
   1.273 -uncopy_transl_16 (Uint32 * dst, void *src, int n,
   1.274 -                  RLEDestFormat * sfmt, SDL_PixelFormat * dfmt)
   1.275 +uncopy_transl_16(Uint32 * dst, void *src, int n,
   1.276 +                 RLEDestFormat * sfmt, SDL_PixelFormat * dfmt)
   1.277  {
   1.278      int i;
   1.279      Uint32 *s = src;
   1.280 @@ -1370,8 +1370,8 @@
   1.281          Uint32 pix = *s++;
   1.282          a = (pix & 0x3e0) >> 2;
   1.283          pix = (pix & ~0x3e0) | pix >> 16;
   1.284 -        RGB_FROM_PIXEL (pix, sfmt, r, g, b);
   1.285 -        PIXEL_FROM_RGBA (*dst, dfmt, r, g, b, a);
   1.286 +        RGB_FROM_PIXEL(pix, sfmt, r, g, b);
   1.287 +        PIXEL_FROM_RGBA(*dst, dfmt, r, g, b, a);
   1.288          dst++;
   1.289      }
   1.290      return n * 4;
   1.291 @@ -1379,16 +1379,16 @@
   1.292  
   1.293  /* encode 32bpp rgba into 32bpp rgba, keeping alpha (dual purpose) */
   1.294  static int
   1.295 -copy_32 (void *dst, Uint32 * src, int n,
   1.296 -         SDL_PixelFormat * sfmt, SDL_PixelFormat * dfmt)
   1.297 +copy_32(void *dst, Uint32 * src, int n,
   1.298 +        SDL_PixelFormat * sfmt, SDL_PixelFormat * dfmt)
   1.299  {
   1.300      int i;
   1.301      Uint32 *d = dst;
   1.302      for (i = 0; i < n; i++) {
   1.303          unsigned r, g, b, a;
   1.304          Uint32 pixel;
   1.305 -        RGBA_FROM_8888 (*src, sfmt, r, g, b, a);
   1.306 -        PIXEL_FROM_RGB (pixel, dfmt, r, g, b);
   1.307 +        RGBA_FROM_8888(*src, sfmt, r, g, b, a);
   1.308 +        PIXEL_FROM_RGB(pixel, dfmt, r, g, b);
   1.309          *d++ = pixel | a << 24;
   1.310          src++;
   1.311      }
   1.312 @@ -1397,17 +1397,17 @@
   1.313  
   1.314  /* decode 32bpp rgba into 32bpp rgba, keeping alpha (dual purpose) */
   1.315  static int
   1.316 -uncopy_32 (Uint32 * dst, void *src, int n,
   1.317 -           RLEDestFormat * sfmt, SDL_PixelFormat * dfmt)
   1.318 +uncopy_32(Uint32 * dst, void *src, int n,
   1.319 +          RLEDestFormat * sfmt, SDL_PixelFormat * dfmt)
   1.320  {
   1.321      int i;
   1.322      Uint32 *s = src;
   1.323      for (i = 0; i < n; i++) {
   1.324          unsigned r, g, b, a;
   1.325          Uint32 pixel = *s++;
   1.326 -        RGB_FROM_PIXEL (pixel, sfmt, r, g, b);
   1.327 +        RGB_FROM_PIXEL(pixel, sfmt, r, g, b);
   1.328          a = pixel >> 24;
   1.329 -        PIXEL_FROM_RGBA (*dst, dfmt, r, g, b, a);
   1.330 +        PIXEL_FROM_RGBA(*dst, dfmt, r, g, b, a);
   1.331          dst++;
   1.332      }
   1.333      return n * 4;
   1.334 @@ -1420,7 +1420,7 @@
   1.335  
   1.336  /* convert surface to be quickly alpha-blittable onto dest, if possible */
   1.337  static int
   1.338 -RLEAlphaSurface (SDL_Surface * surface)
   1.339 +RLEAlphaSurface(SDL_Surface * surface)
   1.340  {
   1.341      SDL_Surface *dest;
   1.342      SDL_PixelFormat *df;
   1.343 @@ -1487,10 +1487,10 @@
   1.344          return -1;              /* anything else unsupported right now */
   1.345      }
   1.346  
   1.347 -    maxsize += sizeof (RLEDestFormat);
   1.348 -    rlebuf = (Uint8 *) SDL_malloc (maxsize);
   1.349 +    maxsize += sizeof(RLEDestFormat);
   1.350 +    rlebuf = (Uint8 *) SDL_malloc(maxsize);
   1.351      if (!rlebuf) {
   1.352 -        SDL_OutOfMemory ();
   1.353 +        SDL_OutOfMemory();
   1.354          return -1;
   1.355      }
   1.356      {
   1.357 @@ -1509,7 +1509,7 @@
   1.358          r->Bmask = df->Bmask;
   1.359          r->Amask = df->Amask;
   1.360      }
   1.361 -    dst = rlebuf + sizeof (RLEDestFormat);
   1.362 +    dst = rlebuf + sizeof(RLEDestFormat);
   1.363  
   1.364      /* Do the actual encoding */
   1.365      {
   1.366 @@ -1543,28 +1543,28 @@
   1.367              do {
   1.368                  int run, skip, len;
   1.369                  skipstart = x;
   1.370 -                while (x < w && !ISOPAQUE (src[x], sf))
   1.371 +                while (x < w && !ISOPAQUE(src[x], sf))
   1.372                      x++;
   1.373                  runstart = x;
   1.374 -                while (x < w && ISOPAQUE (src[x], sf))
   1.375 +                while (x < w && ISOPAQUE(src[x], sf))
   1.376                      x++;
   1.377                  skip = runstart - skipstart;
   1.378                  if (skip == w)
   1.379                      blankline = 1;
   1.380                  run = x - runstart;
   1.381                  while (skip > max_opaque_run) {
   1.382 -                    ADD_OPAQUE_COUNTS (max_opaque_run, 0);
   1.383 +                    ADD_OPAQUE_COUNTS(max_opaque_run, 0);
   1.384                      skip -= max_opaque_run;
   1.385                  }
   1.386 -                len = MIN (run, max_opaque_run);
   1.387 -                ADD_OPAQUE_COUNTS (skip, len);
   1.388 -                dst += copy_opaque (dst, src + runstart, len, sf, df);
   1.389 +                len = MIN(run, max_opaque_run);
   1.390 +                ADD_OPAQUE_COUNTS(skip, len);
   1.391 +                dst += copy_opaque(dst, src + runstart, len, sf, df);
   1.392                  runstart += len;
   1.393                  run -= len;
   1.394                  while (run) {
   1.395 -                    len = MIN (run, max_opaque_run);
   1.396 -                    ADD_OPAQUE_COUNTS (0, len);
   1.397 -                    dst += copy_opaque (dst, src + runstart, len, sf, df);
   1.398 +                    len = MIN(run, max_opaque_run);
   1.399 +                    ADD_OPAQUE_COUNTS(0, len);
   1.400 +                    dst += copy_opaque(dst, src + runstart, len, sf, df);
   1.401                      runstart += len;
   1.402                      run -= len;
   1.403                  }
   1.404 @@ -1579,27 +1579,27 @@
   1.405              do {
   1.406                  int run, skip, len;
   1.407                  skipstart = x;
   1.408 -                while (x < w && !ISTRANSL (src[x], sf))
   1.409 +                while (x < w && !ISTRANSL(src[x], sf))
   1.410                      x++;
   1.411                  runstart = x;
   1.412 -                while (x < w && ISTRANSL (src[x], sf))
   1.413 +                while (x < w && ISTRANSL(src[x], sf))
   1.414                      x++;
   1.415                  skip = runstart - skipstart;
   1.416                  blankline &= (skip == w);
   1.417                  run = x - runstart;
   1.418                  while (skip > max_transl_run) {
   1.419 -                    ADD_TRANSL_COUNTS (max_transl_run, 0);
   1.420 +                    ADD_TRANSL_COUNTS(max_transl_run, 0);
   1.421                      skip -= max_transl_run;
   1.422                  }
   1.423 -                len = MIN (run, max_transl_run);
   1.424 -                ADD_TRANSL_COUNTS (skip, len);
   1.425 -                dst += copy_transl (dst, src + runstart, len, sf, df);
   1.426 +                len = MIN(run, max_transl_run);
   1.427 +                ADD_TRANSL_COUNTS(skip, len);
   1.428 +                dst += copy_transl(dst, src + runstart, len, sf, df);
   1.429                  runstart += len;
   1.430                  run -= len;
   1.431                  while (run) {
   1.432 -                    len = MIN (run, max_transl_run);
   1.433 -                    ADD_TRANSL_COUNTS (0, len);
   1.434 -                    dst += copy_transl (dst, src + runstart, len, sf, df);
   1.435 +                    len = MIN(run, max_transl_run);
   1.436 +                    ADD_TRANSL_COUNTS(0, len);
   1.437 +                    dst += copy_transl(dst, src + runstart, len, sf, df);
   1.438                      runstart += len;
   1.439                      run -= len;
   1.440                  }
   1.441 @@ -1611,7 +1611,7 @@
   1.442              src += surface->pitch >> 2;
   1.443          }
   1.444          dst = lastline;         /* back up past trailing blank lines */
   1.445 -        ADD_OPAQUE_COUNTS (0, 0);
   1.446 +        ADD_OPAQUE_COUNTS(0, 0);
   1.447      }
   1.448  
   1.449  #undef ADD_OPAQUE_COUNTS
   1.450 @@ -1620,13 +1620,13 @@
   1.451      /* Now that we have it encoded, release the original pixels */
   1.452      if ((surface->flags & SDL_PREALLOC) != SDL_PREALLOC
   1.453          && (surface->flags & SDL_HWSURFACE) != SDL_HWSURFACE) {
   1.454 -        SDL_free (surface->pixels);
   1.455 +        SDL_free(surface->pixels);
   1.456          surface->pixels = NULL;
   1.457      }
   1.458  
   1.459      /* realloc the buffer to release unused memory */
   1.460      {
   1.461 -        Uint8 *p = SDL_realloc (rlebuf, dst - rlebuf);
   1.462 +        Uint8 *p = SDL_realloc(rlebuf, dst - rlebuf);
   1.463          if (!p)
   1.464              p = rlebuf;
   1.465          surface->map->sw_data->aux_data = p;
   1.466 @@ -1636,19 +1636,19 @@
   1.467  }
   1.468  
   1.469  static Uint32
   1.470 -getpix_8 (Uint8 * srcbuf)
   1.471 +getpix_8(Uint8 * srcbuf)
   1.472  {
   1.473      return *srcbuf;
   1.474  }
   1.475  
   1.476  static Uint32
   1.477 -getpix_16 (Uint8 * srcbuf)
   1.478 +getpix_16(Uint8 * srcbuf)
   1.479  {
   1.480      return *(Uint16 *) srcbuf;
   1.481  }
   1.482  
   1.483  static Uint32
   1.484 -getpix_24 (Uint8 * srcbuf)
   1.485 +getpix_24(Uint8 * srcbuf)
   1.486  {
   1.487  #if SDL_BYTEORDER == SDL_LIL_ENDIAN
   1.488      return srcbuf[0] + (srcbuf[1] << 8) + (srcbuf[2] << 16);
   1.489 @@ -1658,19 +1658,19 @@
   1.490  }
   1.491  
   1.492  static Uint32
   1.493 -getpix_32 (Uint8 * srcbuf)
   1.494 +getpix_32(Uint8 * srcbuf)
   1.495  {
   1.496      return *(Uint32 *) srcbuf;
   1.497  }
   1.498  
   1.499 -typedef Uint32 (*getpix_func) (Uint8 *);
   1.500 +typedef Uint32(*getpix_func) (Uint8 *);
   1.501  
   1.502  static getpix_func getpixes[4] = {
   1.503      getpix_8, getpix_16, getpix_24, getpix_32
   1.504  };
   1.505  
   1.506  static int
   1.507 -RLEColorkeySurface (SDL_Surface * surface)
   1.508 +RLEColorkeySurface(SDL_Surface * surface)
   1.509  {
   1.510      Uint8 *rlebuf, *dst;
   1.511      int maxn;
   1.512 @@ -1703,9 +1703,9 @@
   1.513          break;
   1.514      }
   1.515  
   1.516 -    rlebuf = (Uint8 *) SDL_malloc (maxsize);
   1.517 +    rlebuf = (Uint8 *) SDL_malloc(maxsize);
   1.518      if (rlebuf == NULL) {
   1.519 -        SDL_OutOfMemory ();
   1.520 +        SDL_OutOfMemory();
   1.521          return (-1);
   1.522      }
   1.523  
   1.524 @@ -1742,10 +1742,10 @@
   1.525              int skipstart = x;
   1.526  
   1.527              /* find run of transparent, then opaque pixels */
   1.528 -            while (x < w && (getpix (srcbuf + x * bpp) & rgbmask) == ckey)
   1.529 +            while (x < w && (getpix(srcbuf + x * bpp) & rgbmask) == ckey)
   1.530                  x++;
   1.531              runstart = x;
   1.532 -            while (x < w && (getpix (srcbuf + x * bpp) & rgbmask) != ckey)
   1.533 +            while (x < w && (getpix(srcbuf + x * bpp) & rgbmask) != ckey)
   1.534                  x++;
   1.535              skip = runstart - skipstart;
   1.536              if (skip == w)
   1.537 @@ -1754,19 +1754,19 @@
   1.538  
   1.539              /* encode segment */
   1.540              while (skip > maxn) {
   1.541 -                ADD_COUNTS (maxn, 0);
   1.542 +                ADD_COUNTS(maxn, 0);
   1.543                  skip -= maxn;
   1.544              }
   1.545 -            len = MIN (run, maxn);
   1.546 -            ADD_COUNTS (skip, len);
   1.547 -            SDL_memcpy (dst, srcbuf + runstart * bpp, len * bpp);
   1.548 +            len = MIN(run, maxn);
   1.549 +            ADD_COUNTS(skip, len);
   1.550 +            SDL_memcpy(dst, srcbuf + runstart * bpp, len * bpp);
   1.551              dst += len * bpp;
   1.552              run -= len;
   1.553              runstart += len;
   1.554              while (run) {
   1.555 -                len = MIN (run, maxn);
   1.556 -                ADD_COUNTS (0, len);
   1.557 -                SDL_memcpy (dst, srcbuf + runstart * bpp, len * bpp);
   1.558 +                len = MIN(run, maxn);
   1.559 +                ADD_COUNTS(0, len);
   1.560 +                SDL_memcpy(dst, srcbuf + runstart * bpp, len * bpp);
   1.561                  dst += len * bpp;
   1.562                  runstart += len;
   1.563                  run -= len;
   1.564 @@ -1779,21 +1779,21 @@
   1.565          srcbuf += surface->pitch;
   1.566      }
   1.567      dst = lastline;             /* back up bast trailing blank lines */
   1.568 -    ADD_COUNTS (0, 0);
   1.569 +    ADD_COUNTS(0, 0);
   1.570  
   1.571  #undef ADD_COUNTS
   1.572  
   1.573      /* Now that we have it encoded, release the original pixels */
   1.574      if ((surface->flags & SDL_PREALLOC) != SDL_PREALLOC
   1.575          && (surface->flags & SDL_HWSURFACE) != SDL_HWSURFACE) {
   1.576 -        SDL_free (surface->pixels);
   1.577 +        SDL_free(surface->pixels);
   1.578          surface->pixels = NULL;
   1.579      }
   1.580  
   1.581      /* realloc the buffer to release unused memory */
   1.582      {
   1.583          /* If realloc returns NULL, the original block is left intact */
   1.584 -        Uint8 *p = SDL_realloc (rlebuf, dst - rlebuf);
   1.585 +        Uint8 *p = SDL_realloc(rlebuf, dst - rlebuf);
   1.586          if (!p)
   1.587              p = rlebuf;
   1.588          surface->map->sw_data->aux_data = p;
   1.589 @@ -1803,13 +1803,13 @@
   1.590  }
   1.591  
   1.592  int
   1.593 -SDL_RLESurface (SDL_Surface * surface)
   1.594 +SDL_RLESurface(SDL_Surface * surface)
   1.595  {
   1.596      int retcode;
   1.597  
   1.598      /* Clear any previous RLE conversion */
   1.599      if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) {
   1.600 -        SDL_UnRLESurface (surface, 1);
   1.601 +        SDL_UnRLESurface(surface, 1);
   1.602      }
   1.603  
   1.604      /* We don't support RLE encoding of bitmaps */
   1.605 @@ -1818,26 +1818,26 @@
   1.606      }
   1.607  
   1.608      /* Lock the surface if it's in hardware */
   1.609 -    if (SDL_MUSTLOCK (surface)) {
   1.610 -        if (SDL_LockSurface (surface) < 0) {
   1.611 +    if (SDL_MUSTLOCK(surface)) {
   1.612 +        if (SDL_LockSurface(surface) < 0) {
   1.613              return (-1);
   1.614          }
   1.615      }
   1.616  
   1.617      /* Encode */
   1.618      if ((surface->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) {
   1.619 -        retcode = RLEColorkeySurface (surface);
   1.620 +        retcode = RLEColorkeySurface(surface);
   1.621      } else {
   1.622          if ((surface->flags & SDL_SRCALPHA) == SDL_SRCALPHA
   1.623              && surface->format->Amask != 0)
   1.624 -            retcode = RLEAlphaSurface (surface);
   1.625 +            retcode = RLEAlphaSurface(surface);
   1.626          else
   1.627              retcode = -1;       /* no RLE for per-surface alpha sans ckey */
   1.628      }
   1.629  
   1.630      /* Unlock the surface if it's in hardware */
   1.631 -    if (SDL_MUSTLOCK (surface)) {
   1.632 -        SDL_UnlockSurface (surface);
   1.633 +    if (SDL_MUSTLOCK(surface)) {
   1.634 +        SDL_UnlockSurface(surface);
   1.635      }
   1.636  
   1.637      if (retcode < 0)
   1.638 @@ -1856,7 +1856,7 @@
   1.639   * may have been reduced (when encoding for 16bpp targets).
   1.640   */
   1.641  static SDL_bool
   1.642 -UnRLEAlpha (SDL_Surface * surface)
   1.643 +UnRLEAlpha(SDL_Surface * surface)
   1.644  {
   1.645      Uint8 *srcbuf;
   1.646      Uint32 *dst;
   1.647 @@ -1876,12 +1876,12 @@
   1.648          uncopy_opaque = uncopy_transl = uncopy_32;
   1.649      }
   1.650  
   1.651 -    surface->pixels = SDL_malloc (surface->h * surface->pitch);
   1.652 +    surface->pixels = SDL_malloc(surface->h * surface->pitch);
   1.653      if (!surface->pixels) {
   1.654          return (SDL_FALSE);
   1.655      }
   1.656      /* fill background with transparent pixels */
   1.657 -    SDL_memset (surface->pixels, 0, surface->h * surface->pitch);
   1.658 +    SDL_memset(surface->pixels, 0, surface->h * surface->pitch);
   1.659  
   1.660      dst = surface->pixels;
   1.661      srcbuf = (Uint8 *) (df + 1);
   1.662 @@ -1900,7 +1900,7 @@
   1.663                  srcbuf += 4;
   1.664              }
   1.665              if (run) {
   1.666 -                srcbuf += uncopy_opaque (dst + ofs, srcbuf, run, df, sf);
   1.667 +                srcbuf += uncopy_opaque(dst + ofs, srcbuf, run, df, sf);
   1.668                  ofs += run;
   1.669              } else if (!ofs)
   1.670                  return (SDL_TRUE);
   1.671 @@ -1919,7 +1919,7 @@
   1.672              run = ((Uint16 *) srcbuf)[1];
   1.673              srcbuf += 4;
   1.674              if (run) {
   1.675 -                srcbuf += uncopy_transl (dst + ofs, srcbuf, run, df, sf);
   1.676 +                srcbuf += uncopy_transl(dst + ofs, srcbuf, run, df, sf);
   1.677                  ofs += run;
   1.678              }
   1.679          }
   1.680 @@ -1931,7 +1931,7 @@
   1.681  }
   1.682  
   1.683  void
   1.684 -SDL_UnRLESurface (SDL_Surface * surface, int recode)
   1.685 +SDL_UnRLESurface(SDL_Surface * surface, int recode)
   1.686  {
   1.687      if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) {
   1.688          surface->flags &= ~SDL_RLEACCEL;
   1.689 @@ -1943,7 +1943,7 @@
   1.690                  unsigned alpha_flag;
   1.691  
   1.692                  /* re-create the original surface */
   1.693 -                surface->pixels = SDL_malloc (surface->h * surface->pitch);
   1.694 +                surface->pixels = SDL_malloc(surface->h * surface->pitch);
   1.695                  if (!surface->pixels) {
   1.696                      /* Oh crap... */
   1.697                      surface->flags |= SDL_RLEACCEL;
   1.698 @@ -1951,7 +1951,7 @@
   1.699                  }
   1.700  
   1.701                  /* fill it with the background colour */
   1.702 -                SDL_FillRect (surface, NULL, surface->format->colorkey);
   1.703 +                SDL_FillRect(surface, NULL, surface->format->colorkey);
   1.704  
   1.705                  /* now render the encoded surface */
   1.706                  full.x = full.y = 0;
   1.707 @@ -1959,10 +1959,10 @@
   1.708                  full.h = surface->h;
   1.709                  alpha_flag = surface->flags & SDL_SRCALPHA;
   1.710                  surface->flags &= ~SDL_SRCALPHA;        /* opaque blit */
   1.711 -                SDL_RLEBlit (surface, &full, surface, &full);
   1.712 +                SDL_RLEBlit(surface, &full, surface, &full);
   1.713                  surface->flags |= alpha_flag;
   1.714              } else {
   1.715 -                if (!UnRLEAlpha (surface)) {
   1.716 +                if (!UnRLEAlpha(surface)) {
   1.717                      /* Oh crap... */
   1.718                      surface->flags |= SDL_RLEACCEL;
   1.719                      return;
   1.720 @@ -1971,7 +1971,7 @@
   1.721          }
   1.722  
   1.723          if (surface->map && surface->map->sw_data->aux_data) {
   1.724 -            SDL_free (surface->map->sw_data->aux_data);
   1.725 +            SDL_free(surface->map->sw_data->aux_data);
   1.726              surface->map->sw_data->aux_data = NULL;
   1.727          }
   1.728      }