src/video/SDL_surface.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1666 6e7ec5cb83c3
child 1670 eef792d31de8
     1.1 --- a/src/video/SDL_surface.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/video/SDL_surface.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -35,18 +35,18 @@
     1.4   * Create an empty RGB surface of the appropriate depth
     1.5   */
     1.6  SDL_Surface *
     1.7 -SDL_CreateRGBSurface (Uint32 flags,
     1.8 -                      int width, int height, int depth,
     1.9 -                      Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
    1.10 +SDL_CreateRGBSurface(Uint32 flags,
    1.11 +                     int width, int height, int depth,
    1.12 +                     Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
    1.13  {
    1.14 -    SDL_VideoDevice *_this = SDL_GetVideoDevice ();
    1.15 +    SDL_VideoDevice *_this = SDL_GetVideoDevice();
    1.16      SDL_Surface *screen;
    1.17      SDL_Surface *surface;
    1.18  
    1.19      /* Make sure the size requested doesn't overflow our datatypes */
    1.20      /* Next time I write a library like SDL, I'll use int for size. :) */
    1.21      if (width >= 16384 || height >= 65536) {
    1.22 -        SDL_SetError ("Width or height is too large");
    1.23 +        SDL_SetError("Width or height is too large");
    1.24          return (NULL);
    1.25      }
    1.26  
    1.27 @@ -75,9 +75,9 @@
    1.28      }
    1.29  
    1.30      /* Allocate the surface */
    1.31 -    surface = (SDL_Surface *) SDL_malloc (sizeof (*surface));
    1.32 +    surface = (SDL_Surface *) SDL_malloc(sizeof(*surface));
    1.33      if (surface == NULL) {
    1.34 -        SDL_OutOfMemory ();
    1.35 +        SDL_OutOfMemory();
    1.36          return (NULL);
    1.37      }
    1.38      surface->flags = SDL_SWSURFACE;
    1.39 @@ -96,9 +96,9 @@
    1.40              Amask = screen->format->Amask;
    1.41          }
    1.42      }
    1.43 -    surface->format = SDL_AllocFormat (depth, Rmask, Gmask, Bmask, Amask);
    1.44 +    surface->format = SDL_AllocFormat(depth, Rmask, Gmask, Bmask, Amask);
    1.45      if (surface->format == NULL) {
    1.46 -        SDL_free (surface);
    1.47 +        SDL_free(surface);
    1.48          return (NULL);
    1.49      }
    1.50      if (Amask) {
    1.51 @@ -106,35 +106,35 @@
    1.52      }
    1.53      surface->w = width;
    1.54      surface->h = height;
    1.55 -    surface->pitch = SDL_CalculatePitch (surface);
    1.56 +    surface->pitch = SDL_CalculatePitch(surface);
    1.57      surface->pixels = NULL;
    1.58      surface->offset = 0;
    1.59      surface->hwdata = NULL;
    1.60      surface->locked = 0;
    1.61      surface->map = NULL;
    1.62      surface->unused1 = 0;
    1.63 -    SDL_SetClipRect (surface, NULL);
    1.64 -    SDL_FormatChanged (surface);
    1.65 +    SDL_SetClipRect(surface, NULL);
    1.66 +    SDL_FormatChanged(surface);
    1.67  
    1.68      /* Get the pixels */
    1.69      if (((flags & SDL_HWSURFACE) == SDL_SWSURFACE) ||
    1.70 -        (_this->AllocHWSurface (_this, surface) < 0)) {
    1.71 +        (_this->AllocHWSurface(_this, surface) < 0)) {
    1.72          if (surface->w && surface->h) {
    1.73 -            surface->pixels = SDL_malloc (surface->h * surface->pitch);
    1.74 +            surface->pixels = SDL_malloc(surface->h * surface->pitch);
    1.75              if (surface->pixels == NULL) {
    1.76 -                SDL_FreeSurface (surface);
    1.77 -                SDL_OutOfMemory ();
    1.78 +                SDL_FreeSurface(surface);
    1.79 +                SDL_OutOfMemory();
    1.80                  return (NULL);
    1.81              }
    1.82              /* This is important for bitmaps */
    1.83 -            SDL_memset (surface->pixels, 0, surface->h * surface->pitch);
    1.84 +            SDL_memset(surface->pixels, 0, surface->h * surface->pitch);
    1.85          }
    1.86      }
    1.87  
    1.88      /* Allocate an empty mapping */
    1.89 -    surface->map = SDL_AllocBlitMap ();
    1.90 +    surface->map = SDL_AllocBlitMap();
    1.91      if (surface->map == NULL) {
    1.92 -        SDL_FreeSurface (surface);
    1.93 +        SDL_FreeSurface(surface);
    1.94          return (NULL);
    1.95      }
    1.96  
    1.97 @@ -150,22 +150,22 @@
    1.98   * Create an RGB surface from an existing memory buffer
    1.99   */
   1.100  SDL_Surface *
   1.101 -SDL_CreateRGBSurfaceFrom (void *pixels,
   1.102 -                          int width, int height, int depth, int pitch,
   1.103 -                          Uint32 Rmask, Uint32 Gmask, Uint32 Bmask,
   1.104 -                          Uint32 Amask)
   1.105 +SDL_CreateRGBSurfaceFrom(void *pixels,
   1.106 +                         int width, int height, int depth, int pitch,
   1.107 +                         Uint32 Rmask, Uint32 Gmask, Uint32 Bmask,
   1.108 +                         Uint32 Amask)
   1.109  {
   1.110      SDL_Surface *surface;
   1.111  
   1.112 -    surface = SDL_CreateRGBSurface (SDL_SWSURFACE, 0, 0, depth,
   1.113 -                                    Rmask, Gmask, Bmask, Amask);
   1.114 +    surface = SDL_CreateRGBSurface(SDL_SWSURFACE, 0, 0, depth,
   1.115 +                                   Rmask, Gmask, Bmask, Amask);
   1.116      if (surface != NULL) {
   1.117          surface->flags |= SDL_PREALLOC;
   1.118          surface->pixels = pixels;
   1.119          surface->w = width;
   1.120          surface->h = height;
   1.121          surface->pitch = pitch;
   1.122 -        SDL_SetClipRect (surface, NULL);
   1.123 +        SDL_SetClipRect(surface, NULL);
   1.124      }
   1.125      return (surface);
   1.126  }
   1.127 @@ -174,7 +174,7 @@
   1.128   * Set the color key in a blittable surface
   1.129   */
   1.130  int
   1.131 -SDL_SetColorKey (SDL_Surface * surface, Uint32 flag, Uint32 key)
   1.132 +SDL_SetColorKey(SDL_Surface * surface, Uint32 flag, Uint32 key)
   1.133  {
   1.134      /* Sanity check the flag as it gets passed in */
   1.135      if (flag & SDL_SRCCOLORKEY) {
   1.136 @@ -195,17 +195,17 @@
   1.137  
   1.138      /* UnRLE surfaces before we change the colorkey */
   1.139      if (surface->flags & SDL_RLEACCEL) {
   1.140 -        SDL_UnRLESurface (surface, 1);
   1.141 +        SDL_UnRLESurface(surface, 1);
   1.142      }
   1.143  
   1.144      if (flag) {
   1.145 -        SDL_VideoDevice *_this = SDL_GetVideoDevice ();
   1.146 +        SDL_VideoDevice *_this = SDL_GetVideoDevice();
   1.147  
   1.148          surface->flags |= SDL_SRCCOLORKEY;
   1.149          surface->format->colorkey = key;
   1.150          if ((surface->flags & SDL_HWACCEL) == SDL_HWACCEL) {
   1.151              if ((_this->SetHWColorKey == NULL) ||
   1.152 -                (_this->SetHWColorKey (_this, surface, key) < 0)) {
   1.153 +                (_this->SetHWColorKey(_this, surface, key) < 0)) {
   1.154                  surface->flags &= ~SDL_HWACCEL;
   1.155              }
   1.156          }
   1.157 @@ -218,13 +218,13 @@
   1.158          surface->flags &= ~(SDL_SRCCOLORKEY | SDL_RLEACCELOK);
   1.159          surface->format->colorkey = 0;
   1.160      }
   1.161 -    SDL_InvalidateMap (surface->map);
   1.162 +    SDL_InvalidateMap(surface->map);
   1.163      return (0);
   1.164  }
   1.165  
   1.166  /* This function sets the alpha channel of a surface */
   1.167  int
   1.168 -SDL_SetAlpha (SDL_Surface * surface, Uint32 flag, Uint8 value)
   1.169 +SDL_SetAlpha(SDL_Surface * surface, Uint32 flag, Uint8 value)
   1.170  {
   1.171      Uint32 oldflags = surface->flags;
   1.172      Uint32 oldalpha = surface->format->alpha;
   1.173 @@ -247,16 +247,16 @@
   1.174      }
   1.175  
   1.176      if (!(flag & SDL_RLEACCELOK) && (surface->flags & SDL_RLEACCEL))
   1.177 -        SDL_UnRLESurface (surface, 1);
   1.178 +        SDL_UnRLESurface(surface, 1);
   1.179  
   1.180      if (flag) {
   1.181 -        SDL_VideoDevice *_this = SDL_GetVideoDevice ();
   1.182 +        SDL_VideoDevice *_this = SDL_GetVideoDevice();
   1.183  
   1.184          surface->flags |= SDL_SRCALPHA;
   1.185          surface->format->alpha = value;
   1.186          if ((surface->flags & SDL_HWACCEL) == SDL_HWACCEL) {
   1.187              if ((_this->SetHWAlpha == NULL) ||
   1.188 -                (_this->SetHWAlpha (_this, surface, value) < 0)) {
   1.189 +                (_this->SetHWAlpha(_this, surface, value) < 0)) {
   1.190                  surface->flags &= ~SDL_HWACCEL;
   1.191              }
   1.192          }
   1.193 @@ -278,12 +278,12 @@
   1.194      if ((surface->flags & SDL_HWACCEL) == SDL_HWACCEL
   1.195          || oldflags != surface->flags
   1.196          || (((oldalpha + 1) ^ (value + 1)) & 0x100))
   1.197 -        SDL_InvalidateMap (surface->map);
   1.198 +        SDL_InvalidateMap(surface->map);
   1.199      return (0);
   1.200  }
   1.201  
   1.202  int
   1.203 -SDL_SetAlphaChannel (SDL_Surface * surface, Uint8 value)
   1.204 +SDL_SetAlphaChannel(SDL_Surface * surface, Uint8 value)
   1.205  {
   1.206      int row, col;
   1.207      int offset;
   1.208 @@ -291,7 +291,7 @@
   1.209  
   1.210      if ((surface->format->Amask != 0xFF000000) &&
   1.211          (surface->format->Amask != 0x000000FF)) {
   1.212 -        SDL_SetError ("Unsupported surface alpha mask format");
   1.213 +        SDL_SetError("Unsupported surface alpha mask format");
   1.214          return -1;
   1.215      }
   1.216  #if SDL_BYTEORDER == SDL_LIL_ENDIAN
   1.217 @@ -309,8 +309,8 @@
   1.218  #endif /* Byte ordering */
   1.219  
   1.220      /* Quickly set the alpha channel of an RGBA or ARGB surface */
   1.221 -    if (SDL_MUSTLOCK (surface)) {
   1.222 -        if (SDL_LockSurface (surface) < 0) {
   1.223 +    if (SDL_MUSTLOCK(surface)) {
   1.224 +        if (SDL_LockSurface(surface) < 0) {
   1.225              return -1;
   1.226          }
   1.227      }
   1.228 @@ -323,8 +323,8 @@
   1.229              buf += 4;
   1.230          }
   1.231      }
   1.232 -    if (SDL_MUSTLOCK (surface)) {
   1.233 -        SDL_UnlockSurface (surface);
   1.234 +    if (SDL_MUSTLOCK(surface)) {
   1.235 +        SDL_UnlockSurface(surface);
   1.236      }
   1.237      return 0;
   1.238  }
   1.239 @@ -334,8 +334,8 @@
   1.240   * return true if the rectangles intersect, false otherwise
   1.241   */
   1.242  static __inline__ SDL_bool
   1.243 -SDL_IntersectRect (const SDL_Rect * A, const SDL_Rect * B,
   1.244 -                   SDL_Rect * intersection)
   1.245 +SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B,
   1.246 +                  SDL_Rect * intersection)
   1.247  {
   1.248      int Amin, Amax, Bmin, Bmax;
   1.249  
   1.250 @@ -370,7 +370,7 @@
   1.251   * Set the clipping rectangle for a blittable surface
   1.252   */
   1.253  SDL_bool
   1.254 -SDL_SetClipRect (SDL_Surface * surface, const SDL_Rect * rect)
   1.255 +SDL_SetClipRect(SDL_Surface * surface, const SDL_Rect * rect)
   1.256  {
   1.257      SDL_Rect full_rect;
   1.258  
   1.259 @@ -390,11 +390,11 @@
   1.260          surface->clip_rect = full_rect;
   1.261          return 1;
   1.262      }
   1.263 -    return SDL_IntersectRect (rect, &full_rect, &surface->clip_rect);
   1.264 +    return SDL_IntersectRect(rect, &full_rect, &surface->clip_rect);
   1.265  }
   1.266  
   1.267  void
   1.268 -SDL_GetClipRect (SDL_Surface * surface, SDL_Rect * rect)
   1.269 +SDL_GetClipRect(SDL_Surface * surface, SDL_Rect * rect)
   1.270  {
   1.271      if (surface && rect) {
   1.272          *rect = surface->clip_rect;
   1.273 @@ -413,15 +413,15 @@
   1.274   * by calling the one(s) you need.
   1.275   */
   1.276  int
   1.277 -SDL_LowerBlit (SDL_Surface * src, SDL_Rect * srcrect,
   1.278 -               SDL_Surface * dst, SDL_Rect * dstrect)
   1.279 +SDL_LowerBlit(SDL_Surface * src, SDL_Rect * srcrect,
   1.280 +              SDL_Surface * dst, SDL_Rect * dstrect)
   1.281  {
   1.282      SDL_blit do_blit;
   1.283  
   1.284      /* Check to make sure the blit mapping is valid */
   1.285      if ((src->map->dst != dst) ||
   1.286          (src->map->dst->format_version != src->map->format_version)) {
   1.287 -        if (SDL_MapSurface (src, dst) < 0) {
   1.288 +        if (SDL_MapSurface(src, dst) < 0) {
   1.289              return (-1);
   1.290          }
   1.291      }
   1.292 @@ -432,24 +432,24 @@
   1.293      } else {
   1.294          do_blit = src->map->sw_blit;
   1.295      }
   1.296 -    return (do_blit (src, srcrect, dst, dstrect));
   1.297 +    return (do_blit(src, srcrect, dst, dstrect));
   1.298  }
   1.299  
   1.300  
   1.301  int
   1.302 -SDL_UpperBlit (SDL_Surface * src, SDL_Rect * srcrect,
   1.303 -               SDL_Surface * dst, SDL_Rect * dstrect)
   1.304 +SDL_UpperBlit(SDL_Surface * src, SDL_Rect * srcrect,
   1.305 +              SDL_Surface * dst, SDL_Rect * dstrect)
   1.306  {
   1.307      SDL_Rect fulldst;
   1.308      int srcx, srcy, w, h;
   1.309  
   1.310      /* Make sure the surfaces aren't locked */
   1.311      if (!src || !dst) {
   1.312 -        SDL_SetError ("SDL_UpperBlit: passed a NULL surface");
   1.313 +        SDL_SetError("SDL_UpperBlit: passed a NULL surface");
   1.314          return (-1);
   1.315      }
   1.316      if (src->locked || dst->locked) {
   1.317 -        SDL_SetError ("Surfaces must not be locked during blit");
   1.318 +        SDL_SetError("Surfaces must not be locked during blit");
   1.319          return (-1);
   1.320      }
   1.321  
   1.322 @@ -523,25 +523,25 @@
   1.323          sr.y = srcy;
   1.324          sr.w = dstrect->w = w;
   1.325          sr.h = dstrect->h = h;
   1.326 -        return SDL_LowerBlit (src, &sr, dst, dstrect);
   1.327 +        return SDL_LowerBlit(src, &sr, dst, dstrect);
   1.328      }
   1.329      dstrect->w = dstrect->h = 0;
   1.330      return 0;
   1.331  }
   1.332  
   1.333  static int
   1.334 -SDL_FillRect1 (SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color)
   1.335 +SDL_FillRect1(SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color)
   1.336  {
   1.337      /* FIXME: We have to worry about packing order.. *sigh* */
   1.338 -    SDL_SetError ("1-bpp rect fill not yet implemented");
   1.339 +    SDL_SetError("1-bpp rect fill not yet implemented");
   1.340      return -1;
   1.341  }
   1.342  
   1.343  static int
   1.344 -SDL_FillRect4 (SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color)
   1.345 +SDL_FillRect4(SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color)
   1.346  {
   1.347      /* FIXME: We have to worry about packing order.. *sigh* */
   1.348 -    SDL_SetError ("4-bpp rect fill not yet implemented");
   1.349 +    SDL_SetError("4-bpp rect fill not yet implemented");
   1.350      return -1;
   1.351  }
   1.352  
   1.353 @@ -549,9 +549,9 @@
   1.354   * This function performs a fast fill of the given rectangle with 'color'
   1.355   */
   1.356  int
   1.357 -SDL_FillRect (SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color)
   1.358 +SDL_FillRect(SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color)
   1.359  {
   1.360 -    SDL_VideoDevice *_this = SDL_GetVideoDevice ();
   1.361 +    SDL_VideoDevice *_this = SDL_GetVideoDevice();
   1.362      int x, y;
   1.363      Uint8 *row;
   1.364  
   1.365 @@ -559,13 +559,13 @@
   1.366      if (dst->format->BitsPerPixel < 8) {
   1.367          switch (dst->format->BitsPerPixel) {
   1.368          case 1:
   1.369 -            return SDL_FillRect1 (dst, dstrect, color);
   1.370 +            return SDL_FillRect1(dst, dstrect, color);
   1.371              break;
   1.372          case 4:
   1.373 -            return SDL_FillRect4 (dst, dstrect, color);
   1.374 +            return SDL_FillRect4(dst, dstrect, color);
   1.375              break;
   1.376          default:
   1.377 -            SDL_SetError ("Fill rect on unsupported surface format");
   1.378 +            SDL_SetError("Fill rect on unsupported surface format");
   1.379              return (-1);
   1.380              break;
   1.381          }
   1.382 @@ -574,7 +574,7 @@
   1.383      /* If 'dstrect' == NULL, then fill the whole surface */
   1.384      if (dstrect) {
   1.385          /* Perform clipping */
   1.386 -        if (!SDL_IntersectRect (dstrect, &dst->clip_rect, dstrect)) {
   1.387 +        if (!SDL_IntersectRect(dstrect, &dst->clip_rect, dstrect)) {
   1.388              return (0);
   1.389          }
   1.390      } else {
   1.391 @@ -584,11 +584,11 @@
   1.392      /* Check for hardware acceleration */
   1.393      if (((dst->flags & SDL_HWSURFACE) == SDL_HWSURFACE) &&
   1.394          _this->info.blit_fill) {
   1.395 -        return (_this->FillHWRect (_this, dst, dstrect, color));
   1.396 +        return (_this->FillHWRect(_this, dst, dstrect, color));
   1.397      }
   1.398  
   1.399      /* Perform software fill */
   1.400 -    if (SDL_LockSurface (dst) != 0) {
   1.401 +    if (SDL_LockSurface(dst) != 0) {
   1.402          return (-1);
   1.403      }
   1.404      row = (Uint8 *) dst->pixels + dstrect->y * dst->pitch +
   1.405 @@ -599,7 +599,7 @@
   1.406              && !(dst->pitch & 3)) {
   1.407              int n = x >> 2;
   1.408              for (y = dstrect->h; y; --y) {
   1.409 -                SDL_memset4 (row, 0, n);
   1.410 +                SDL_memset4(row, 0, n);
   1.411                  row += dst->pitch;
   1.412              }
   1.413          } else {
   1.414 @@ -617,34 +617,34 @@
   1.415                       * efficient to uncached video memory
   1.416                       */
   1.417                      double fill;
   1.418 -                    SDL_memset (&fill, color, (sizeof fill));
   1.419 +                    SDL_memset(&fill, color, (sizeof fill));
   1.420                      for (y = dstrect->h; y; y--) {
   1.421                          Uint8 *d = row;
   1.422                          unsigned n = x;
   1.423                          unsigned nn;
   1.424                          Uint8 c = color;
   1.425                          double f = fill;
   1.426 -                        while ((unsigned long) d & (sizeof (double) - 1)) {
   1.427 +                        while ((unsigned long) d & (sizeof(double) - 1)) {
   1.428                              *d++ = c;
   1.429                              n--;
   1.430                          }
   1.431 -                        nn = n / (sizeof (double) * 4);
   1.432 +                        nn = n / (sizeof(double) * 4);
   1.433                          while (nn) {
   1.434                              ((double *) d)[0] = f;
   1.435                              ((double *) d)[1] = f;
   1.436                              ((double *) d)[2] = f;
   1.437                              ((double *) d)[3] = f;
   1.438 -                            d += 4 * sizeof (double);
   1.439 +                            d += 4 * sizeof(double);
   1.440                              nn--;
   1.441                          }
   1.442 -                        n &= ~(sizeof (double) * 4 - 1);
   1.443 -                        nn = n / sizeof (double);
   1.444 +                        n &= ~(sizeof(double) * 4 - 1);
   1.445 +                        nn = n / sizeof(double);
   1.446                          while (nn) {
   1.447                              *(double *) d = f;
   1.448 -                            d += sizeof (double);
   1.449 +                            d += sizeof(double);
   1.450                              nn--;
   1.451                          }
   1.452 -                        n &= ~(sizeof (double) - 1);
   1.453 +                        n &= ~(sizeof(double) - 1);
   1.454                          while (n) {
   1.455                              *d++ = c;
   1.456                              n--;
   1.457 @@ -668,7 +668,7 @@
   1.458  #endif /* __powerpc__ */
   1.459              {
   1.460                  for (y = dstrect->h; y; y--) {
   1.461 -                    SDL_memset (row, color, x);
   1.462 +                    SDL_memset(row, color, x);
   1.463                      row += dst->pitch;
   1.464                  }
   1.465              }
   1.466 @@ -686,7 +686,7 @@
   1.467                      n--;
   1.468                  }
   1.469                  if (n >> 1)
   1.470 -                    SDL_memset4 (pixels, cc, n >> 1);
   1.471 +                    SDL_memset4(pixels, cc, n >> 1);
   1.472                  if (n & 1)
   1.473                      pixels[n - 1] = c;
   1.474                  row += dst->pitch;
   1.475 @@ -700,7 +700,7 @@
   1.476              for (y = dstrect->h; y; --y) {
   1.477                  Uint8 *pixels = row;
   1.478                  for (x = dstrect->w; x; --x) {
   1.479 -                    SDL_memcpy (pixels, &color, 3);
   1.480 +                    SDL_memcpy(pixels, &color, 3);
   1.481                      pixels += 3;
   1.482                  }
   1.483                  row += dst->pitch;
   1.484 @@ -709,13 +709,13 @@
   1.485  
   1.486          case 4:
   1.487              for (y = dstrect->h; y; --y) {
   1.488 -                SDL_memset4 (row, color, dstrect->w);
   1.489 +                SDL_memset4(row, color, dstrect->w);
   1.490                  row += dst->pitch;
   1.491              }
   1.492              break;
   1.493          }
   1.494      }
   1.495 -    SDL_UnlockSurface (dst);
   1.496 +    SDL_UnlockSurface(dst);
   1.497  
   1.498      /* We're done! */
   1.499      return (0);
   1.500 @@ -725,18 +725,18 @@
   1.501   * Lock a surface to directly access the pixels
   1.502   */
   1.503  int
   1.504 -SDL_LockSurface (SDL_Surface * surface)
   1.505 +SDL_LockSurface(SDL_Surface * surface)
   1.506  {
   1.507      if (!surface->locked) {
   1.508          /* Perform the lock */
   1.509          if (surface->flags & SDL_HWSURFACE) {
   1.510 -            SDL_VideoDevice *_this = SDL_GetVideoDevice ();
   1.511 -            if (_this->LockHWSurface (_this, surface) < 0) {
   1.512 +            SDL_VideoDevice *_this = SDL_GetVideoDevice();
   1.513 +            if (_this->LockHWSurface(_this, surface) < 0) {
   1.514                  return (-1);
   1.515              }
   1.516          }
   1.517          if (surface->flags & SDL_RLEACCEL) {
   1.518 -            SDL_UnRLESurface (surface, 1);
   1.519 +            SDL_UnRLESurface(surface, 1);
   1.520              surface->flags |= SDL_RLEACCEL;     /* save accel'd state */
   1.521          }
   1.522          /* This needs to be done here in case pixels changes value */
   1.523 @@ -754,7 +754,7 @@
   1.524   * Unlock a previously locked surface
   1.525   */
   1.526  void
   1.527 -SDL_UnlockSurface (SDL_Surface * surface)
   1.528 +SDL_UnlockSurface(SDL_Surface * surface)
   1.529  {
   1.530      /* Only perform an unlock if we are locked */
   1.531      if (!surface->locked || (--surface->locked > 0)) {
   1.532 @@ -766,13 +766,13 @@
   1.533  
   1.534      /* Unlock hardware or accelerated surfaces */
   1.535      if (surface->flags & SDL_HWSURFACE) {
   1.536 -        SDL_VideoDevice *_this = SDL_GetVideoDevice ();
   1.537 -        _this->UnlockHWSurface (_this, surface);
   1.538 +        SDL_VideoDevice *_this = SDL_GetVideoDevice();
   1.539 +        _this->UnlockHWSurface(_this, surface);
   1.540      } else {
   1.541          /* Update RLE encoded surface with new data */
   1.542          if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) {
   1.543              surface->flags &= ~SDL_RLEACCEL;    /* stop lying */
   1.544 -            SDL_RLESurface (surface);
   1.545 +            SDL_RLESurface(surface);
   1.546          }
   1.547      }
   1.548  }
   1.549 @@ -781,8 +781,8 @@
   1.550   * Convert a surface into the specified pixel format.
   1.551   */
   1.552  SDL_Surface *
   1.553 -SDL_ConvertSurface (SDL_Surface * surface,
   1.554 -                    SDL_PixelFormat * format, Uint32 flags)
   1.555 +SDL_ConvertSurface(SDL_Surface * surface,
   1.556 +                   SDL_PixelFormat * format, Uint32 flags)
   1.557  {
   1.558      SDL_Surface *convert;
   1.559      Uint32 colorkey = 0;
   1.560 @@ -800,7 +800,7 @@
   1.561                  break;
   1.562          }
   1.563          if (i == format->palette->ncolors) {
   1.564 -            SDL_SetError ("Empty destination palette");
   1.565 +            SDL_SetError("Empty destination palette");
   1.566              return (NULL);
   1.567          }
   1.568      }
   1.569 @@ -808,26 +808,26 @@
   1.570      /* Only create hw surfaces with alpha channel if hw alpha blits
   1.571         are supported */
   1.572      if (format->Amask != 0 && (flags & SDL_HWSURFACE)) {
   1.573 -        const SDL_VideoInfo *vi = SDL_GetVideoInfo ();
   1.574 +        const SDL_VideoInfo *vi = SDL_GetVideoInfo();
   1.575          if (!vi || !vi->blit_hw_A)
   1.576              flags &= ~SDL_HWSURFACE;
   1.577      }
   1.578  
   1.579      /* Create a new surface with the desired format */
   1.580 -    convert = SDL_CreateRGBSurface (flags,
   1.581 -                                    surface->w, surface->h,
   1.582 -                                    format->BitsPerPixel, format->Rmask,
   1.583 -                                    format->Gmask, format->Bmask,
   1.584 -                                    format->Amask);
   1.585 +    convert = SDL_CreateRGBSurface(flags,
   1.586 +                                   surface->w, surface->h,
   1.587 +                                   format->BitsPerPixel, format->Rmask,
   1.588 +                                   format->Gmask, format->Bmask,
   1.589 +                                   format->Amask);
   1.590      if (convert == NULL) {
   1.591          return (NULL);
   1.592      }
   1.593  
   1.594      /* Copy the palette if any */
   1.595      if (format->palette && convert->format->palette) {
   1.596 -        SDL_memcpy (convert->format->palette->colors,
   1.597 -                    format->palette->colors,
   1.598 -                    format->palette->ncolors * sizeof (SDL_Color));
   1.599 +        SDL_memcpy(convert->format->palette->colors,
   1.600 +                   format->palette->colors,
   1.601 +                   format->palette->ncolors * sizeof(SDL_Color));
   1.602          convert->format->palette->ncolors = format->palette->ncolors;
   1.603      }
   1.604  
   1.605 @@ -839,7 +839,7 @@
   1.606              surface_flags &= ~SDL_SRCCOLORKEY;
   1.607          } else {
   1.608              colorkey = surface->format->colorkey;
   1.609 -            SDL_SetColorKey (surface, 0, 0);
   1.610 +            SDL_SetColorKey(surface, 0, 0);
   1.611          }
   1.612      }
   1.613      if ((surface_flags & SDL_SRCALPHA) == SDL_SRCALPHA) {
   1.614 @@ -848,7 +848,7 @@
   1.615              surface->flags &= ~SDL_SRCALPHA;
   1.616          } else {
   1.617              alpha = surface->format->alpha;
   1.618 -            SDL_SetAlpha (surface, 0, 0);
   1.619 +            SDL_SetAlpha(surface, 0, 0);
   1.620          }
   1.621      }
   1.622  
   1.623 @@ -857,32 +857,32 @@
   1.624      bounds.y = 0;
   1.625      bounds.w = surface->w;
   1.626      bounds.h = surface->h;
   1.627 -    SDL_LowerBlit (surface, &bounds, convert, &bounds);
   1.628 +    SDL_LowerBlit(surface, &bounds, convert, &bounds);
   1.629  
   1.630      /* Clean up the original surface, and update converted surface */
   1.631      if (convert != NULL) {
   1.632 -        SDL_SetClipRect (convert, &surface->clip_rect);
   1.633 +        SDL_SetClipRect(convert, &surface->clip_rect);
   1.634      }
   1.635      if ((surface_flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) {
   1.636          Uint32 cflags = surface_flags & (SDL_SRCCOLORKEY | SDL_RLEACCELOK);
   1.637          if (convert != NULL) {
   1.638              Uint8 keyR, keyG, keyB;
   1.639  
   1.640 -            SDL_GetRGB (colorkey, surface->format, &keyR, &keyG, &keyB);
   1.641 -            SDL_SetColorKey (convert, cflags | (flags & SDL_RLEACCELOK),
   1.642 -                             SDL_MapRGB (convert->format, keyR, keyG, keyB));
   1.643 +            SDL_GetRGB(colorkey, surface->format, &keyR, &keyG, &keyB);
   1.644 +            SDL_SetColorKey(convert, cflags | (flags & SDL_RLEACCELOK),
   1.645 +                            SDL_MapRGB(convert->format, keyR, keyG, keyB));
   1.646          }
   1.647 -        SDL_SetColorKey (surface, cflags, colorkey);
   1.648 +        SDL_SetColorKey(surface, cflags, colorkey);
   1.649      }
   1.650      if ((surface_flags & SDL_SRCALPHA) == SDL_SRCALPHA) {
   1.651          Uint32 aflags = surface_flags & (SDL_SRCALPHA | SDL_RLEACCELOK);
   1.652          if (convert != NULL) {
   1.653 -            SDL_SetAlpha (convert, aflags | (flags & SDL_RLEACCELOK), alpha);
   1.654 +            SDL_SetAlpha(convert, aflags | (flags & SDL_RLEACCELOK), alpha);
   1.655          }
   1.656          if (format->Amask) {
   1.657              surface->flags |= SDL_SRCALPHA;
   1.658          } else {
   1.659 -            SDL_SetAlpha (surface, aflags, alpha);
   1.660 +            SDL_SetAlpha(surface, aflags, alpha);
   1.661          }
   1.662      }
   1.663  
   1.664 @@ -894,7 +894,7 @@
   1.665   * Free a surface created by the above function.
   1.666   */
   1.667  void
   1.668 -SDL_FreeSurface (SDL_Surface * surface)
   1.669 +SDL_FreeSurface(SDL_Surface * surface)
   1.670  {
   1.671      if (surface == NULL) {
   1.672          return;
   1.673 @@ -903,27 +903,27 @@
   1.674          return;
   1.675      }
   1.676      while (surface->locked > 0) {
   1.677 -        SDL_UnlockSurface (surface);
   1.678 +        SDL_UnlockSurface(surface);
   1.679      }
   1.680      if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) {
   1.681 -        SDL_UnRLESurface (surface, 0);
   1.682 +        SDL_UnRLESurface(surface, 0);
   1.683      }
   1.684      if (surface->format) {
   1.685 -        SDL_FreeFormat (surface->format);
   1.686 +        SDL_FreeFormat(surface->format);
   1.687          surface->format = NULL;
   1.688      }
   1.689      if (surface->map != NULL) {
   1.690 -        SDL_FreeBlitMap (surface->map);
   1.691 +        SDL_FreeBlitMap(surface->map);
   1.692          surface->map = NULL;
   1.693      }
   1.694      if (surface->hwdata) {
   1.695 -        SDL_VideoDevice *_this = SDL_GetVideoDevice ();
   1.696 -        _this->FreeHWSurface (_this, surface);
   1.697 +        SDL_VideoDevice *_this = SDL_GetVideoDevice();
   1.698 +        _this->FreeHWSurface(_this, surface);
   1.699      }
   1.700      if (surface->pixels && ((surface->flags & SDL_PREALLOC) != SDL_PREALLOC)) {
   1.701 -        SDL_free (surface->pixels);
   1.702 +        SDL_free(surface->pixels);
   1.703      }
   1.704 -    SDL_free (surface);
   1.705 +    SDL_free(surface);
   1.706  #ifdef CHECK_LEAKS
   1.707      --surfaces_allocated;
   1.708  #endif