src/video/windib/SDL_dibvideo.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
child 1704 03fb364e3283
     1.1 --- a/src/video/windib/SDL_dibvideo.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/video/windib/SDL_dibvideo.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -68,78 +68,78 @@
     1.4  #endif
     1.5  
     1.6  /* Initialization/Query functions */
     1.7 -static int DIB_VideoInit (_THIS, SDL_PixelFormat * vformat);
     1.8 -static SDL_Rect **DIB_ListModes (_THIS, SDL_PixelFormat * format,
     1.9 -                                 Uint32 flags);
    1.10 -SDL_Surface *DIB_SetVideoMode (_THIS, SDL_Surface * current, int width,
    1.11 -                               int height, int bpp, Uint32 flags);
    1.12 -static int DIB_SetColors (_THIS, int firstcolor, int ncolors,
    1.13 -                          SDL_Color * colors);
    1.14 -static void DIB_CheckGamma (_THIS);
    1.15 -void DIB_SwapGamma (_THIS);
    1.16 -void DIB_QuitGamma (_THIS);
    1.17 -int DIB_SetGammaRamp (_THIS, Uint16 * ramp);
    1.18 -int DIB_GetGammaRamp (_THIS, Uint16 * ramp);
    1.19 -static void DIB_VideoQuit (_THIS);
    1.20 +static int DIB_VideoInit(_THIS, SDL_PixelFormat * vformat);
    1.21 +static SDL_Rect **DIB_ListModes(_THIS, SDL_PixelFormat * format,
    1.22 +                                Uint32 flags);
    1.23 +SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface * current, int width,
    1.24 +                              int height, int bpp, Uint32 flags);
    1.25 +static int DIB_SetColors(_THIS, int firstcolor, int ncolors,
    1.26 +                         SDL_Color * colors);
    1.27 +static void DIB_CheckGamma(_THIS);
    1.28 +void DIB_SwapGamma(_THIS);
    1.29 +void DIB_QuitGamma(_THIS);
    1.30 +int DIB_SetGammaRamp(_THIS, Uint16 * ramp);
    1.31 +int DIB_GetGammaRamp(_THIS, Uint16 * ramp);
    1.32 +static void DIB_VideoQuit(_THIS);
    1.33  
    1.34  /* Hardware surface functions */
    1.35 -static int DIB_AllocHWSurface (_THIS, SDL_Surface * surface);
    1.36 -static int DIB_LockHWSurface (_THIS, SDL_Surface * surface);
    1.37 -static void DIB_UnlockHWSurface (_THIS, SDL_Surface * surface);
    1.38 -static void DIB_FreeHWSurface (_THIS, SDL_Surface * surface);
    1.39 +static int DIB_AllocHWSurface(_THIS, SDL_Surface * surface);
    1.40 +static int DIB_LockHWSurface(_THIS, SDL_Surface * surface);
    1.41 +static void DIB_UnlockHWSurface(_THIS, SDL_Surface * surface);
    1.42 +static void DIB_FreeHWSurface(_THIS, SDL_Surface * surface);
    1.43  
    1.44  /* Windows message handling functions */
    1.45 -static void DIB_RealizePalette (_THIS);
    1.46 -static void DIB_PaletteChanged (_THIS, HWND window);
    1.47 -static void DIB_WinPAINT (_THIS, HDC hdc);
    1.48 +static void DIB_RealizePalette(_THIS);
    1.49 +static void DIB_PaletteChanged(_THIS, HWND window);
    1.50 +static void DIB_WinPAINT(_THIS, HDC hdc);
    1.51  
    1.52  /* helper fn */
    1.53 -static int DIB_SussScreenDepth ();
    1.54 +static int DIB_SussScreenDepth();
    1.55  
    1.56  /* DIB driver bootstrap functions */
    1.57  
    1.58  static int
    1.59 -DIB_Available (void)
    1.60 +DIB_Available(void)
    1.61  {
    1.62      return (1);
    1.63  }
    1.64  
    1.65  static void
    1.66 -DIB_DeleteDevice (SDL_VideoDevice * device)
    1.67 +DIB_DeleteDevice(SDL_VideoDevice * device)
    1.68  {
    1.69      if (device) {
    1.70          if (device->hidden) {
    1.71 -            SDL_free (device->hidden);
    1.72 +            SDL_free(device->hidden);
    1.73          }
    1.74          if (device->gl_data) {
    1.75 -            SDL_free (device->gl_data);
    1.76 +            SDL_free(device->gl_data);
    1.77          }
    1.78 -        SDL_free (device);
    1.79 +        SDL_free(device);
    1.80      }
    1.81  }
    1.82  
    1.83  static SDL_VideoDevice *
    1.84 -DIB_CreateDevice (int devindex)
    1.85 +DIB_CreateDevice(int devindex)
    1.86  {
    1.87      SDL_VideoDevice *device;
    1.88  
    1.89      /* Initialize all variables that we clean on shutdown */
    1.90 -    device = (SDL_VideoDevice *) SDL_malloc (sizeof (SDL_VideoDevice));
    1.91 +    device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
    1.92      if (device) {
    1.93 -        SDL_memset (device, 0, (sizeof *device));
    1.94 +        SDL_memset(device, 0, (sizeof *device));
    1.95          device->hidden = (struct SDL_PrivateVideoData *)
    1.96 -            SDL_malloc ((sizeof *device->hidden));
    1.97 +            SDL_malloc((sizeof *device->hidden));
    1.98          device->gl_data = (struct SDL_PrivateGLData *)
    1.99 -            SDL_malloc ((sizeof *device->gl_data));
   1.100 +            SDL_malloc((sizeof *device->gl_data));
   1.101      }
   1.102      if ((device == NULL) || (device->hidden == NULL) ||
   1.103          (device->gl_data == NULL)) {
   1.104 -        SDL_OutOfMemory ();
   1.105 -        DIB_DeleteDevice (device);
   1.106 +        SDL_OutOfMemory();
   1.107 +        DIB_DeleteDevice(device);
   1.108          return (NULL);
   1.109      }
   1.110 -    SDL_memset (device->hidden, 0, (sizeof *device->hidden));
   1.111 -    SDL_memset (device->gl_data, 0, (sizeof *device->gl_data));
   1.112 +    SDL_memset(device->hidden, 0, (sizeof *device->hidden));
   1.113 +    SDL_memset(device->gl_data, 0, (sizeof *device->gl_data));
   1.114  
   1.115      /* Set the function pointers */
   1.116      device->VideoInit = DIB_VideoInit;
   1.117 @@ -198,7 +198,7 @@
   1.118  };
   1.119  
   1.120  static int
   1.121 -cmpmodes (const void *va, const void *vb)
   1.122 +cmpmodes(const void *va, const void *vb)
   1.123  {
   1.124      SDL_Rect *a = *(SDL_Rect **) va;
   1.125      SDL_Rect *b = *(SDL_Rect **) vb;
   1.126 @@ -209,7 +209,7 @@
   1.127  }
   1.128  
   1.129  static int
   1.130 -DIB_AddMode (_THIS, int bpp, int w, int h)
   1.131 +DIB_AddMode(_THIS, int bpp, int w, int h)
   1.132  {
   1.133      SDL_Rect *mode;
   1.134      int i, index;
   1.135 @@ -228,9 +228,9 @@
   1.136      }
   1.137  
   1.138      /* Set up the new video mode rectangle */
   1.139 -    mode = (SDL_Rect *) SDL_malloc (sizeof *mode);
   1.140 +    mode = (SDL_Rect *) SDL_malloc(sizeof *mode);
   1.141      if (mode == NULL) {
   1.142 -        SDL_OutOfMemory ();
   1.143 +        SDL_OutOfMemory();
   1.144          return (-1);
   1.145      }
   1.146      mode->x = 0;
   1.147 @@ -241,12 +241,12 @@
   1.148      /* Allocate the new list of modes, and fill in the new mode */
   1.149      next_mode = SDL_nummodes[index];
   1.150      SDL_modelist[index] = (SDL_Rect **)
   1.151 -        SDL_realloc (SDL_modelist[index],
   1.152 -                     (1 + next_mode + 1) * sizeof (SDL_Rect *));
   1.153 +        SDL_realloc(SDL_modelist[index],
   1.154 +                    (1 + next_mode + 1) * sizeof(SDL_Rect *));
   1.155      if (SDL_modelist[index] == NULL) {
   1.156 -        SDL_OutOfMemory ();
   1.157 +        SDL_OutOfMemory();
   1.158          SDL_nummodes[index] = 0;
   1.159 -        SDL_free (mode);
   1.160 +        SDL_free(mode);
   1.161          return (-1);
   1.162      }
   1.163      SDL_modelist[index][next_mode] = mode;
   1.164 @@ -257,7 +257,7 @@
   1.165  }
   1.166  
   1.167  static HPALETTE
   1.168 -DIB_CreatePalette (int bpp)
   1.169 +DIB_CreatePalette(int bpp)
   1.170  {
   1.171  /*	RJR: March 28, 2000
   1.172  	moved palette creation here from "DIB_VideoInit" */
   1.173 @@ -274,22 +274,22 @@
   1.174          for (i = 0; i < bpp; ++i) {
   1.175              ncolors *= 2;
   1.176          }
   1.177 -        palette = (LOGPALETTE *) SDL_malloc (sizeof (*palette) +
   1.178 -                                             ncolors * sizeof (PALETTEENTRY));
   1.179 +        palette = (LOGPALETTE *) SDL_malloc(sizeof(*palette) +
   1.180 +                                            ncolors * sizeof(PALETTEENTRY));
   1.181          palette->palVersion = 0x300;
   1.182          palette->palNumEntries = ncolors;
   1.183 -        hdc = GetDC (SDL_Window);
   1.184 -        GetSystemPaletteEntries (hdc, 0, ncolors, palette->palPalEntry);
   1.185 -        ReleaseDC (SDL_Window, hdc);
   1.186 -        handle = CreatePalette (palette);
   1.187 -        SDL_free (palette);
   1.188 +        hdc = GetDC(SDL_Window);
   1.189 +        GetSystemPaletteEntries(hdc, 0, ncolors, palette->palPalEntry);
   1.190 +        ReleaseDC(SDL_Window, hdc);
   1.191 +        handle = CreatePalette(palette);
   1.192 +        SDL_free(palette);
   1.193      }
   1.194  
   1.195      return handle;
   1.196  }
   1.197  
   1.198  int
   1.199 -DIB_VideoInit (_THIS, SDL_PixelFormat * vformat)
   1.200 +DIB_VideoInit(_THIS, SDL_PixelFormat * vformat)
   1.201  {
   1.202  #ifndef NO_CHANGEDISPLAYSETTINGS
   1.203      int i;
   1.204 @@ -297,15 +297,15 @@
   1.205  #endif
   1.206  
   1.207      /* Create the window */
   1.208 -    if (DIB_CreateWindow (this) < 0) {
   1.209 +    if (DIB_CreateWindow(this) < 0) {
   1.210          return (-1);
   1.211      }
   1.212  #if !SDL_AUDIO_DISABLED
   1.213 -    DX5_SoundFocus (SDL_Window);
   1.214 +    DX5_SoundFocus(SDL_Window);
   1.215  #endif
   1.216  
   1.217      /* Determine the screen depth */
   1.218 -    vformat->BitsPerPixel = DIB_SussScreenDepth ();
   1.219 +    vformat->BitsPerPixel = DIB_SussScreenDepth();
   1.220      switch (vformat->BitsPerPixel) {
   1.221      case 15:
   1.222          vformat->Rmask = 0x00007c00;
   1.223 @@ -330,38 +330,38 @@
   1.224      }
   1.225  
   1.226      /* See if gamma is supported on this screen */
   1.227 -    DIB_CheckGamma (this);
   1.228 +    DIB_CheckGamma(this);
   1.229  
   1.230  #ifndef NO_CHANGEDISPLAYSETTINGS
   1.231  
   1.232 -    settings.dmSize = sizeof (DEVMODE);
   1.233 +    settings.dmSize = sizeof(DEVMODE);
   1.234      settings.dmDriverExtra = 0;
   1.235  #ifdef _WIN32_WCE
   1.236      settings.dmFields = DM_DISPLAYQUERYORIENTATION;
   1.237      this->hidden->supportRotation =
   1.238 -        ChangeDisplaySettingsEx (NULL, &settings, NULL, CDS_TEST,
   1.239 -                                 NULL) == DISP_CHANGE_SUCCESSFUL;
   1.240 +        ChangeDisplaySettingsEx(NULL, &settings, NULL, CDS_TEST,
   1.241 +                                NULL) == DISP_CHANGE_SUCCESSFUL;
   1.242  #endif
   1.243      /* Query for the desktop resolution */
   1.244 -    EnumDisplaySettings (NULL, ENUM_CURRENT_SETTINGS, &SDL_desktop_mode);
   1.245 +    EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &SDL_desktop_mode);
   1.246      this->info.current_w = SDL_desktop_mode.dmPelsWidth;
   1.247      this->info.current_h = SDL_desktop_mode.dmPelsHeight;
   1.248  
   1.249      /* Query for the list of available video modes */
   1.250 -    for (i = 0; EnumDisplaySettings (NULL, i, &settings); ++i) {
   1.251 -        DIB_AddMode (this, settings.dmBitsPerPel,
   1.252 -                     settings.dmPelsWidth, settings.dmPelsHeight);
   1.253 +    for (i = 0; EnumDisplaySettings(NULL, i, &settings); ++i) {
   1.254 +        DIB_AddMode(this, settings.dmBitsPerPel,
   1.255 +                    settings.dmPelsWidth, settings.dmPelsHeight);
   1.256  #ifdef _WIN32_WCE
   1.257          if (this->hidden->supportRotation)
   1.258 -            DIB_AddMode (this, settings.dmBitsPerPel,
   1.259 -                         settings.dmPelsHeight, settings.dmPelsWidth);
   1.260 +            DIB_AddMode(this, settings.dmBitsPerPel,
   1.261 +                        settings.dmPelsHeight, settings.dmPelsWidth);
   1.262  #endif
   1.263      }
   1.264      /* Sort the mode lists */
   1.265      for (i = 0; i < NUM_MODELISTS; ++i) {
   1.266          if (SDL_nummodes[i] > 0) {
   1.267 -            SDL_qsort (SDL_modelist[i], SDL_nummodes[i],
   1.268 -                       sizeof *SDL_modelist[i], cmpmodes);
   1.269 +            SDL_qsort(SDL_modelist[i], SDL_nummodes[i],
   1.270 +                      sizeof *SDL_modelist[i], cmpmodes);
   1.271          }
   1.272      }
   1.273  #else
   1.274 @@ -371,9 +371,9 @@
   1.275      // because SDL surface conversion is much faster than the WinCE one.
   1.276      // Although it should be tested on devices with graphics accelerator.
   1.277  
   1.278 -    DIB_AddMode (this, vformat->BitsPerPixel,
   1.279 -                 GetDeviceCaps (GetDC (NULL), HORZRES),
   1.280 -                 GetDeviceCaps (GetDC (NULL), VERTRES));
   1.281 +    DIB_AddMode(this, vformat->BitsPerPixel,
   1.282 +                GetDeviceCaps(GetDC(NULL), HORZRES),
   1.283 +                GetDeviceCaps(GetDC(NULL), VERTRES));
   1.284  
   1.285  #endif /* !NO_CHANGEDISPLAYSETTINGS */
   1.286  
   1.287 @@ -381,7 +381,7 @@
   1.288      if (vformat->BitsPerPixel <= 8) {
   1.289          /*      RJR: March 28, 2000
   1.290             moved palette creation to "DIB_CreatePalette" */
   1.291 -        screen_pal = DIB_CreatePalette (vformat->BitsPerPixel);
   1.292 +        screen_pal = DIB_CreatePalette(vformat->BitsPerPixel);
   1.293      }
   1.294  
   1.295      /* Fill in some window manager capabilities */
   1.296 @@ -397,7 +397,7 @@
   1.297  
   1.298  /* We support any format at any dimension */
   1.299  SDL_Rect **
   1.300 -DIB_ListModes (_THIS, SDL_PixelFormat * format, Uint32 flags)
   1.301 +DIB_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags)
   1.302  {
   1.303      if ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) {
   1.304          return (SDL_modelist[((format->BitsPerPixel + 7) / 8) - 1]);
   1.305 @@ -415,15 +415,15 @@
   1.306    http://www.wdj.com/code/archive.html)
   1.307  */
   1.308  static int
   1.309 -DIB_SussScreenDepth ()
   1.310 +DIB_SussScreenDepth()
   1.311  {
   1.312  #ifdef NO_GETDIBITS
   1.313      int depth;
   1.314      HDC hdc;
   1.315  
   1.316 -    hdc = GetDC (SDL_Window);
   1.317 -    depth = GetDeviceCaps (hdc, PLANES) * GetDeviceCaps (hdc, BITSPIXEL);
   1.318 -    ReleaseDC (SDL_Window, hdc);
   1.319 +    hdc = GetDC(SDL_Window);
   1.320 +    depth = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL);
   1.321 +    ReleaseDC(SDL_Window, hdc);
   1.322      return (depth);
   1.323  #else
   1.324      int dib_size;
   1.325 @@ -434,25 +434,25 @@
   1.326      /* Allocate enough space for a DIB header plus palette (for
   1.327       * 8-bit modes) or bitfields (for 16- and 32-bit modes)
   1.328       */
   1.329 -    dib_size = sizeof (BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD);
   1.330 -    dib_hdr = (LPBITMAPINFOHEADER) SDL_malloc (dib_size);
   1.331 -    SDL_memset (dib_hdr, 0, dib_size);
   1.332 -    dib_hdr->biSize = sizeof (BITMAPINFOHEADER);
   1.333 +    dib_size = sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD);
   1.334 +    dib_hdr = (LPBITMAPINFOHEADER) SDL_malloc(dib_size);
   1.335 +    SDL_memset(dib_hdr, 0, dib_size);
   1.336 +    dib_hdr->biSize = sizeof(BITMAPINFOHEADER);
   1.337  
   1.338      /* Get a device-dependent bitmap that's compatible with the
   1.339         screen.
   1.340       */
   1.341 -    hdc = GetDC (NULL);
   1.342 -    hbm = CreateCompatibleBitmap (hdc, 1, 1);
   1.343 +    hdc = GetDC(NULL);
   1.344 +    hbm = CreateCompatibleBitmap(hdc, 1, 1);
   1.345  
   1.346      /* Convert the DDB to a DIB.  We need to call GetDIBits twice:
   1.347       * the first call just fills in the BITMAPINFOHEADER; the 
   1.348       * second fills in the bitfields or palette.
   1.349       */
   1.350 -    GetDIBits (hdc, hbm, 0, 1, NULL, (LPBITMAPINFO) dib_hdr, DIB_RGB_COLORS);
   1.351 -    GetDIBits (hdc, hbm, 0, 1, NULL, (LPBITMAPINFO) dib_hdr, DIB_RGB_COLORS);
   1.352 -    DeleteObject (hbm);
   1.353 -    ReleaseDC (NULL, hdc);
   1.354 +    GetDIBits(hdc, hbm, 0, 1, NULL, (LPBITMAPINFO) dib_hdr, DIB_RGB_COLORS);
   1.355 +    GetDIBits(hdc, hbm, 0, 1, NULL, (LPBITMAPINFO) dib_hdr, DIB_RGB_COLORS);
   1.356 +    DeleteObject(hbm);
   1.357 +    ReleaseDC(NULL, hdc);
   1.358  
   1.359      switch (dib_hdr->biBitCount) {
   1.360      case 8:
   1.361 @@ -478,11 +478,11 @@
   1.362  
   1.363  
   1.364  /* Various screen update functions available */
   1.365 -static void DIB_NormalUpdate (_THIS, int numrects, SDL_Rect * rects);
   1.366 +static void DIB_NormalUpdate(_THIS, int numrects, SDL_Rect * rects);
   1.367  
   1.368  SDL_Surface *
   1.369 -DIB_SetVideoMode (_THIS, SDL_Surface * current,
   1.370 -                  int width, int height, int bpp, Uint32 flags)
   1.371 +DIB_SetVideoMode(_THIS, SDL_Surface * current,
   1.372 +                 int width, int height, int bpp, Uint32 flags)
   1.373  {
   1.374      SDL_Surface *video;
   1.375      Uint32 prev_flags;
   1.376 @@ -500,7 +500,7 @@
   1.377  
   1.378      /* Clean up any GL context that may be hanging around */
   1.379      if (current->flags & SDL_INTERNALOPENGL) {
   1.380 -        WIN_GL_ShutDown (this);
   1.381 +        WIN_GL_ShutDown(this);
   1.382      }
   1.383      SDL_resizing = 1;
   1.384  
   1.385 @@ -511,7 +511,7 @@
   1.386          switch (bpp) {
   1.387          case 15:
   1.388          case 16:
   1.389 -            if (DIB_SussScreenDepth () == 15) {
   1.390 +            if (DIB_SussScreenDepth() == 15) {
   1.391                  /* 5-5-5 */
   1.392                  Rmask = 0x00007c00;
   1.393                  Gmask = 0x000003e0;
   1.394 @@ -536,10 +536,10 @@
   1.395              Bmask = 0x00000000;
   1.396              break;
   1.397          }
   1.398 -        video = SDL_CreateRGBSurface (SDL_SWSURFACE,
   1.399 -                                      0, 0, bpp, Rmask, Gmask, Bmask, 0);
   1.400 +        video = SDL_CreateRGBSurface(SDL_SWSURFACE,
   1.401 +                                     0, 0, bpp, Rmask, Gmask, Bmask, 0);
   1.402          if (video == NULL) {
   1.403 -            SDL_OutOfMemory ();
   1.404 +            SDL_OutOfMemory();
   1.405              return (NULL);
   1.406          }
   1.407      }
   1.408 @@ -549,7 +549,7 @@
   1.409      video->flags = 0;           /* Clear flags */
   1.410      video->w = width;
   1.411      video->h = height;
   1.412 -    video->pitch = SDL_CalculatePitch (video);
   1.413 +    video->pitch = SDL_CalculatePitch(video);
   1.414  
   1.415      /* Small fix for WinCE/Win32 - when activating window
   1.416         SDL_VideoSurface is equal to zero, so activating code
   1.417 @@ -569,8 +569,8 @@
   1.418          DEVMODE settings;
   1.419          BOOL changed;
   1.420  
   1.421 -        SDL_memset (&settings, 0, sizeof (DEVMODE));
   1.422 -        settings.dmSize = sizeof (DEVMODE);
   1.423 +        SDL_memset(&settings, 0, sizeof(DEVMODE));
   1.424 +        settings.dmSize = sizeof(DEVMODE);
   1.425  
   1.426  #ifdef _WIN32_WCE
   1.427          // try to rotate screen to fit requested resolution
   1.428 @@ -579,11 +579,11 @@
   1.429  
   1.430              // ask current mode
   1.431              settings.dmFields = DM_DISPLAYORIENTATION;
   1.432 -            ChangeDisplaySettingsEx (NULL, &settings, NULL, CDS_TEST, NULL);
   1.433 +            ChangeDisplaySettingsEx(NULL, &settings, NULL, CDS_TEST, NULL);
   1.434              rotation = settings.dmDisplayOrientation;
   1.435  
   1.436 -            if ((width > GetDeviceCaps (GetDC (NULL), HORZRES))
   1.437 -                && (height < GetDeviceCaps (GetDC (NULL), VERTRES))) {
   1.438 +            if ((width > GetDeviceCaps(GetDC(NULL), HORZRES))
   1.439 +                && (height < GetDeviceCaps(GetDC(NULL), VERTRES))) {
   1.440                  switch (rotation) {
   1.441                  case DMDO_0:
   1.442                      settings.dmDisplayOrientation = DMDO_90;
   1.443 @@ -595,12 +595,12 @@
   1.444                  if (settings.dmDisplayOrientation != rotation) {
   1.445                      // go to landscape
   1.446                      this->hidden->origRotation = rotation;
   1.447 -                    ChangeDisplaySettingsEx (NULL, &settings, NULL,
   1.448 -                                             CDS_RESET, NULL);
   1.449 +                    ChangeDisplaySettingsEx(NULL, &settings, NULL,
   1.450 +                                            CDS_RESET, NULL);
   1.451                  }
   1.452              }
   1.453 -            if ((width < GetDeviceCaps (GetDC (NULL), HORZRES))
   1.454 -                && (height > GetDeviceCaps (GetDC (NULL), VERTRES))) {
   1.455 +            if ((width < GetDeviceCaps(GetDC(NULL), HORZRES))
   1.456 +                && (height > GetDeviceCaps(GetDC(NULL), VERTRES))) {
   1.457                  switch (rotation) {
   1.458                  case DMDO_90:
   1.459                      settings.dmDisplayOrientation = DMDO_0;
   1.460 @@ -612,8 +612,8 @@
   1.461                  if (settings.dmDisplayOrientation != rotation) {
   1.462                      // go to portrait
   1.463                      this->hidden->origRotation = rotation;
   1.464 -                    ChangeDisplaySettingsEx (NULL, &settings, NULL,
   1.465 -                                             CDS_RESET, NULL);
   1.466 +                    ChangeDisplaySettingsEx(NULL, &settings, NULL,
   1.467 +                                            CDS_RESET, NULL);
   1.468                  }
   1.469              }
   1.470  
   1.471 @@ -631,12 +631,12 @@
   1.472              settings.dmFields |= DM_DISPLAYFREQUENCY;
   1.473          }
   1.474          changed =
   1.475 -            (ChangeDisplaySettings (&settings, CDS_FULLSCREEN) ==
   1.476 +            (ChangeDisplaySettings(&settings, CDS_FULLSCREEN) ==
   1.477               DISP_CHANGE_SUCCESSFUL);
   1.478          if (!changed && (settings.dmFields & DM_DISPLAYFREQUENCY)) {
   1.479              settings.dmFields &= ~DM_DISPLAYFREQUENCY;
   1.480              changed =
   1.481 -                (ChangeDisplaySettings (&settings, CDS_FULLSCREEN) ==
   1.482 +                (ChangeDisplaySettings(&settings, CDS_FULLSCREEN) ==
   1.483                   DISP_CHANGE_SUCCESSFUL);
   1.484          }
   1.485  #else
   1.486 @@ -654,16 +654,16 @@
   1.487      if (screen_pal != NULL) {
   1.488          /*      RJR: March 28, 2000
   1.489             delete identity palette if switching from a palettized mode */
   1.490 -        DeleteObject (screen_pal);
   1.491 +        DeleteObject(screen_pal);
   1.492          screen_pal = NULL;
   1.493      }
   1.494      if (bpp <= 8) {
   1.495          /*      RJR: March 28, 2000
   1.496             create identity palette switching to a palettized mode */
   1.497 -        screen_pal = DIB_CreatePalette (bpp);
   1.498 +        screen_pal = DIB_CreatePalette(bpp);
   1.499      }
   1.500  
   1.501 -    style = GetWindowLong (SDL_Window, GWL_STYLE);
   1.502 +    style = GetWindowLong(SDL_Window, GWL_STYLE);
   1.503      style &= ~(resizestyle | WS_MAXIMIZE);
   1.504      if ((video->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) {
   1.505          style &= ~windowstyle;
   1.506 @@ -671,7 +671,7 @@
   1.507      } else {
   1.508  #ifndef NO_CHANGEDISPLAYSETTINGS
   1.509          if ((prev_flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) {
   1.510 -            ChangeDisplaySettings (NULL, 0);
   1.511 +            ChangeDisplaySettings(NULL, 0);
   1.512          }
   1.513  #endif
   1.514          if (flags & SDL_NOFRAME) {
   1.515 @@ -687,40 +687,40 @@
   1.516              }
   1.517          }
   1.518  #if WS_MAXIMIZE
   1.519 -        if (IsZoomed (SDL_Window))
   1.520 +        if (IsZoomed(SDL_Window))
   1.521              style |= WS_MAXIMIZE;
   1.522  #endif
   1.523      }
   1.524  
   1.525      /* DJM: Don't piss of anyone who has setup his own window */
   1.526      if (!SDL_windowid)
   1.527 -        SetWindowLong (SDL_Window, GWL_STYLE, style);
   1.528 +        SetWindowLong(SDL_Window, GWL_STYLE, style);
   1.529  
   1.530      /* Delete the old bitmap if necessary */
   1.531      if (screen_bmp != NULL) {
   1.532 -        DeleteObject (screen_bmp);
   1.533 +        DeleteObject(screen_bmp);
   1.534      }
   1.535      if (!(flags & SDL_INTERNALOPENGL)) {
   1.536          BOOL is16bitmode = (video->format->BytesPerPixel == 2);
   1.537  
   1.538          /* Suss out the bitmap info header */
   1.539 -        binfo_size = sizeof (*binfo);
   1.540 +        binfo_size = sizeof(*binfo);
   1.541          if (is16bitmode) {
   1.542              /* 16bit modes, palette area used for rgb bitmasks */
   1.543 -            binfo_size += 3 * sizeof (DWORD);
   1.544 +            binfo_size += 3 * sizeof(DWORD);
   1.545          } else if (video->format->palette) {
   1.546 -            binfo_size += video->format->palette->ncolors * sizeof (RGBQUAD);
   1.547 +            binfo_size += video->format->palette->ncolors * sizeof(RGBQUAD);
   1.548          }
   1.549 -        binfo = (BITMAPINFO *) SDL_malloc (binfo_size);
   1.550 +        binfo = (BITMAPINFO *) SDL_malloc(binfo_size);
   1.551          if (!binfo) {
   1.552              if (video != current) {
   1.553 -                SDL_FreeSurface (video);
   1.554 +                SDL_FreeSurface(video);
   1.555              }
   1.556 -            SDL_OutOfMemory ();
   1.557 +            SDL_OutOfMemory();
   1.558              return (NULL);
   1.559          }
   1.560  
   1.561 -        binfo->bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
   1.562 +        binfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
   1.563          binfo->bmiHeader.biWidth = video->w;
   1.564          binfo->bmiHeader.biHeight = -video->h;  /* -ve for topdown bitmap */
   1.565          binfo->bmiHeader.biPlanes = 1;
   1.566 @@ -740,23 +740,22 @@
   1.567          } else {
   1.568              binfo->bmiHeader.biCompression = BI_RGB;    /* BI_BITFIELDS for 565 vs 555 */
   1.569              if (video->format->palette) {
   1.570 -                SDL_memset (binfo->bmiColors, 0,
   1.571 -                            video->format->palette->ncolors *
   1.572 -                            sizeof (RGBQUAD));
   1.573 +                SDL_memset(binfo->bmiColors, 0,
   1.574 +                           video->format->palette->ncolors * sizeof(RGBQUAD));
   1.575              }
   1.576          }
   1.577  
   1.578          /* Create the offscreen bitmap buffer */
   1.579 -        hdc = GetDC (SDL_Window);
   1.580 -        screen_bmp = CreateDIBSection (hdc, binfo, DIB_RGB_COLORS,
   1.581 -                                       (void **) (&video->pixels), NULL, 0);
   1.582 -        ReleaseDC (SDL_Window, hdc);
   1.583 -        SDL_free (binfo);
   1.584 +        hdc = GetDC(SDL_Window);
   1.585 +        screen_bmp = CreateDIBSection(hdc, binfo, DIB_RGB_COLORS,
   1.586 +                                      (void **) (&video->pixels), NULL, 0);
   1.587 +        ReleaseDC(SDL_Window, hdc);
   1.588 +        SDL_free(binfo);
   1.589          if (screen_bmp == NULL) {
   1.590              if (video != current) {
   1.591 -                SDL_FreeSurface (video);
   1.592 +                SDL_FreeSurface(video);
   1.593              }
   1.594 -            SDL_SetError ("Couldn't create DIB section");
   1.595 +            SDL_SetError("Couldn't create DIB section");
   1.596              return (NULL);
   1.597          }
   1.598          this->UpdateRects = DIB_NormalUpdate;
   1.599 @@ -769,7 +768,7 @@
   1.600      }
   1.601  #ifndef _WIN32_WCE
   1.602      /* Resize the window */
   1.603 -    if (!SDL_windowid && !IsZoomed (SDL_Window)) {
   1.604 +    if (!SDL_windowid && !IsZoomed(SDL_Window)) {
   1.605  #else
   1.606      if (!SDL_windowid) {
   1.607  #endif
   1.608 @@ -779,14 +778,14 @@
   1.609          const char *center = NULL;
   1.610  
   1.611          if (!SDL_windowX && !SDL_windowY) {
   1.612 -            window = SDL_getenv ("SDL_VIDEO_WINDOW_POS");
   1.613 -            center = SDL_getenv ("SDL_VIDEO_CENTERED");
   1.614 +            window = SDL_getenv("SDL_VIDEO_WINDOW_POS");
   1.615 +            center = SDL_getenv("SDL_VIDEO_CENTERED");
   1.616              if (window) {
   1.617 -                if (SDL_sscanf (window, "%d,%d", &x, &y) == 2) {
   1.618 +                if (SDL_sscanf(window, "%d,%d", &x, &y) == 2) {
   1.619                      SDL_windowX = x;
   1.620                      SDL_windowY = y;
   1.621                  }
   1.622 -                if (SDL_strcmp (window, "center") == 0) {
   1.623 +                if (SDL_strcmp(window, "center") == 0) {
   1.624                      center = window;
   1.625                  }
   1.626              }
   1.627 @@ -797,16 +796,16 @@
   1.628          bounds.top = SDL_windowY;
   1.629          bounds.right = SDL_windowX + video->w;
   1.630          bounds.bottom = SDL_windowY + video->h;
   1.631 -        AdjustWindowRectEx (&bounds, GetWindowLong (SDL_Window, GWL_STYLE),
   1.632 -                            FALSE, 0);
   1.633 +        AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE),
   1.634 +                           FALSE, 0);
   1.635          width = bounds.right - bounds.left;
   1.636          height = bounds.bottom - bounds.top;
   1.637          if ((flags & SDL_FULLSCREEN)) {
   1.638 -            x = (GetSystemMetrics (SM_CXSCREEN) - width) / 2;
   1.639 -            y = (GetSystemMetrics (SM_CYSCREEN) - height) / 2;
   1.640 +            x = (GetSystemMetrics(SM_CXSCREEN) - width) / 2;
   1.641 +            y = (GetSystemMetrics(SM_CYSCREEN) - height) / 2;
   1.642          } else if (center) {
   1.643 -            x = (GetSystemMetrics (SM_CXSCREEN) - width) / 2;
   1.644 -            y = (GetSystemMetrics (SM_CYSCREEN) - height) / 2;
   1.645 +            x = (GetSystemMetrics(SM_CXSCREEN) - width) / 2;
   1.646 +            y = (GetSystemMetrics(SM_CYSCREEN) - height) / 2;
   1.647          } else if (SDL_windowX || SDL_windowY || window) {
   1.648              x = bounds.left;
   1.649              y = bounds.top;
   1.650 @@ -819,18 +818,18 @@
   1.651          } else {
   1.652              top = HWND_NOTOPMOST;
   1.653          }
   1.654 -        SetWindowPos (SDL_Window, top, x, y, width, height, swp_flags);
   1.655 +        SetWindowPos(SDL_Window, top, x, y, width, height, swp_flags);
   1.656          if (!(flags & SDL_FULLSCREEN)) {
   1.657              SDL_windowX = SDL_bounds.left;
   1.658              SDL_windowY = SDL_bounds.top;
   1.659          }
   1.660 -        SetForegroundWindow (SDL_Window);
   1.661 +        SetForegroundWindow(SDL_Window);
   1.662      }
   1.663      SDL_resizing = 0;
   1.664  
   1.665      /* Set up for OpenGL */
   1.666      if (flags & SDL_INTERNALOPENGL) {
   1.667 -        if (WIN_GL_SetupWindow (this) < 0) {
   1.668 +        if (WIN_GL_SetupWindow(this) < 0) {
   1.669              return (NULL);
   1.670          }
   1.671          video->flags |= SDL_INTERNALOPENGL;
   1.672 @@ -840,7 +839,7 @@
   1.673         Flush the message loop or this can cause big problems later
   1.674         Especially if the user decides to use dialog boxes or assert()!
   1.675       */
   1.676 -    WIN_FlushMessageQueue ();
   1.677 +    WIN_FlushMessageQueue();
   1.678  
   1.679      /* We're live! */
   1.680      return (video);
   1.681 @@ -848,49 +847,49 @@
   1.682  
   1.683  /* We don't actually allow hardware surfaces in the DIB driver */
   1.684  static int
   1.685 -DIB_AllocHWSurface (_THIS, SDL_Surface * surface)
   1.686 +DIB_AllocHWSurface(_THIS, SDL_Surface * surface)
   1.687  {
   1.688      return (-1);
   1.689  }
   1.690  static void
   1.691 -DIB_FreeHWSurface (_THIS, SDL_Surface * surface)
   1.692 +DIB_FreeHWSurface(_THIS, SDL_Surface * surface)
   1.693  {
   1.694      return;
   1.695  }
   1.696  static int
   1.697 -DIB_LockHWSurface (_THIS, SDL_Surface * surface)
   1.698 +DIB_LockHWSurface(_THIS, SDL_Surface * surface)
   1.699  {
   1.700      return (0);
   1.701  }
   1.702  static void
   1.703 -DIB_UnlockHWSurface (_THIS, SDL_Surface * surface)
   1.704 +DIB_UnlockHWSurface(_THIS, SDL_Surface * surface)
   1.705  {
   1.706      return;
   1.707  }
   1.708  
   1.709  static void
   1.710 -DIB_NormalUpdate (_THIS, int numrects, SDL_Rect * rects)
   1.711 +DIB_NormalUpdate(_THIS, int numrects, SDL_Rect * rects)
   1.712  {
   1.713      HDC hdc, mdc;
   1.714      int i;
   1.715  
   1.716 -    hdc = GetDC (SDL_Window);
   1.717 +    hdc = GetDC(SDL_Window);
   1.718      if (screen_pal) {
   1.719 -        SelectPalette (hdc, screen_pal, FALSE);
   1.720 +        SelectPalette(hdc, screen_pal, FALSE);
   1.721      }
   1.722 -    mdc = CreateCompatibleDC (hdc);
   1.723 -    SelectObject (mdc, screen_bmp);
   1.724 +    mdc = CreateCompatibleDC(hdc);
   1.725 +    SelectObject(mdc, screen_bmp);
   1.726      for (i = 0; i < numrects; ++i) {
   1.727 -        BitBlt (hdc, rects[i].x, rects[i].y, rects[i].w, rects[i].h,
   1.728 -                mdc, rects[i].x, rects[i].y, SRCCOPY);
   1.729 +        BitBlt(hdc, rects[i].x, rects[i].y, rects[i].w, rects[i].h,
   1.730 +               mdc, rects[i].x, rects[i].y, SRCCOPY);
   1.731      }
   1.732 -    DeleteDC (mdc);
   1.733 -    ReleaseDC (SDL_Window, hdc);
   1.734 +    DeleteDC(mdc);
   1.735 +    ReleaseDC(SDL_Window, hdc);
   1.736  }
   1.737  
   1.738  
   1.739  int
   1.740 -DIB_SetColors (_THIS, int firstcolor, int ncolors, SDL_Color * colors)
   1.741 +DIB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors)
   1.742  {
   1.743  #if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400)
   1.744      HDC hdc, mdc;
   1.745 @@ -901,25 +900,25 @@
   1.746      int i;
   1.747  
   1.748      /* Update the display palette */
   1.749 -    hdc = GetDC (SDL_Window);
   1.750 +    hdc = GetDC(SDL_Window);
   1.751      if (screen_pal) {
   1.752          PALETTEENTRY *entries;
   1.753  
   1.754 -        entries = SDL_stack_alloc (PALETTEENTRY, ncolors);
   1.755 +        entries = SDL_stack_alloc(PALETTEENTRY, ncolors);
   1.756          for (i = 0; i < ncolors; ++i) {
   1.757              entries[i].peRed = colors[i].r;
   1.758              entries[i].peGreen = colors[i].g;
   1.759              entries[i].peBlue = colors[i].b;
   1.760              entries[i].peFlags = PC_NOCOLLAPSE;
   1.761          }
   1.762 -        SetPaletteEntries (screen_pal, firstcolor, ncolors, entries);
   1.763 -        SelectPalette (hdc, screen_pal, FALSE);
   1.764 -        RealizePalette (hdc);
   1.765 -        SDL_stack_free (entries);
   1.766 +        SetPaletteEntries(screen_pal, firstcolor, ncolors, entries);
   1.767 +        SelectPalette(hdc, screen_pal, FALSE);
   1.768 +        RealizePalette(hdc);
   1.769 +        SDL_stack_free(entries);
   1.770      }
   1.771  #if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400)
   1.772      /* Copy palette colors into DIB palette */
   1.773 -    pal = SDL_stack_alloc (RGBQUAD, ncolors);
   1.774 +    pal = SDL_stack_alloc(RGBQUAD, ncolors);
   1.775      for (i = 0; i < ncolors; ++i) {
   1.776          pal[i].rgbRed = colors[i].r;
   1.777          pal[i].rgbGreen = colors[i].g;
   1.778 @@ -928,81 +927,81 @@
   1.779      }
   1.780  
   1.781      /* Set the DIB palette and update the display */
   1.782 -    mdc = CreateCompatibleDC (hdc);
   1.783 -    SelectObject (mdc, screen_bmp);
   1.784 -    SetDIBColorTable (mdc, firstcolor, ncolors, pal);
   1.785 -    BitBlt (hdc, 0, 0, this->screen->w, this->screen->h, mdc, 0, 0, SRCCOPY);
   1.786 -    DeleteDC (mdc);
   1.787 -    SDL_stack_free (pal);
   1.788 +    mdc = CreateCompatibleDC(hdc);
   1.789 +    SelectObject(mdc, screen_bmp);
   1.790 +    SetDIBColorTable(mdc, firstcolor, ncolors, pal);
   1.791 +    BitBlt(hdc, 0, 0, this->screen->w, this->screen->h, mdc, 0, 0, SRCCOPY);
   1.792 +    DeleteDC(mdc);
   1.793 +    SDL_stack_free(pal);
   1.794  #endif
   1.795 -    ReleaseDC (SDL_Window, hdc);
   1.796 +    ReleaseDC(SDL_Window, hdc);
   1.797      return (1);
   1.798  }
   1.799  
   1.800  
   1.801  static void
   1.802 -DIB_CheckGamma (_THIS)
   1.803 +DIB_CheckGamma(_THIS)
   1.804  {
   1.805  #ifndef NO_GAMMA_SUPPORT
   1.806      HDC hdc;
   1.807      WORD ramp[3 * 256];
   1.808  
   1.809      /* If we fail to get gamma, disable gamma control */
   1.810 -    hdc = GetDC (SDL_Window);
   1.811 -    if (!GetDeviceGammaRamp (hdc, ramp)) {
   1.812 +    hdc = GetDC(SDL_Window);
   1.813 +    if (!GetDeviceGammaRamp(hdc, ramp)) {
   1.814          this->GetGammaRamp = NULL;
   1.815          this->SetGammaRamp = NULL;
   1.816      }
   1.817 -    ReleaseDC (SDL_Window, hdc);
   1.818 +    ReleaseDC(SDL_Window, hdc);
   1.819  #endif /* !NO_GAMMA_SUPPORT */
   1.820  }
   1.821  
   1.822  void
   1.823 -DIB_SwapGamma (_THIS)
   1.824 +DIB_SwapGamma(_THIS)
   1.825  {
   1.826  #ifndef NO_GAMMA_SUPPORT
   1.827      HDC hdc;
   1.828  
   1.829      if (gamma_saved) {
   1.830 -        hdc = GetDC (SDL_Window);
   1.831 -        if (SDL_GetAppState () & SDL_APPINPUTFOCUS) {
   1.832 +        hdc = GetDC(SDL_Window);
   1.833 +        if (SDL_GetAppState() & SDL_APPINPUTFOCUS) {
   1.834              /* About to leave active state, restore gamma */
   1.835 -            SetDeviceGammaRamp (hdc, gamma_saved);
   1.836 +            SetDeviceGammaRamp(hdc, gamma_saved);
   1.837          } else {
   1.838              /* About to enter active state, set game gamma */
   1.839 -            GetDeviceGammaRamp (hdc, gamma_saved);
   1.840 -            SetDeviceGammaRamp (hdc, this->gamma);
   1.841 +            GetDeviceGammaRamp(hdc, gamma_saved);
   1.842 +            SetDeviceGammaRamp(hdc, this->gamma);
   1.843          }
   1.844 -        ReleaseDC (SDL_Window, hdc);
   1.845 +        ReleaseDC(SDL_Window, hdc);
   1.846      }
   1.847  #endif /* !NO_GAMMA_SUPPORT */
   1.848  }
   1.849  void
   1.850 -DIB_QuitGamma (_THIS)
   1.851 +DIB_QuitGamma(_THIS)
   1.852  {
   1.853  #ifndef NO_GAMMA_SUPPORT
   1.854      if (gamma_saved) {
   1.855          /* Restore the original gamma if necessary */
   1.856 -        if (SDL_GetAppState () & SDL_APPINPUTFOCUS) {
   1.857 +        if (SDL_GetAppState() & SDL_APPINPUTFOCUS) {
   1.858              HDC hdc;
   1.859  
   1.860 -            hdc = GetDC (SDL_Window);
   1.861 -            SetDeviceGammaRamp (hdc, gamma_saved);
   1.862 -            ReleaseDC (SDL_Window, hdc);
   1.863 +            hdc = GetDC(SDL_Window);
   1.864 +            SetDeviceGammaRamp(hdc, gamma_saved);
   1.865 +            ReleaseDC(SDL_Window, hdc);
   1.866          }
   1.867  
   1.868          /* Free the saved gamma memory */
   1.869 -        SDL_free (gamma_saved);
   1.870 +        SDL_free(gamma_saved);
   1.871          gamma_saved = 0;
   1.872      }
   1.873  #endif /* !NO_GAMMA_SUPPORT */
   1.874  }
   1.875  
   1.876  int
   1.877 -DIB_SetGammaRamp (_THIS, Uint16 * ramp)
   1.878 +DIB_SetGammaRamp(_THIS, Uint16 * ramp)
   1.879  {
   1.880  #ifdef NO_GAMMA_SUPPORT
   1.881 -    SDL_SetError ("SDL compiled without gamma ramp support");
   1.882 +    SDL_SetError("SDL compiled without gamma ramp support");
   1.883      return -1;
   1.884  #else
   1.885      HDC hdc;
   1.886 @@ -1010,19 +1009,19 @@
   1.887  
   1.888      /* Set the ramp for the display */
   1.889      if (!gamma_saved) {
   1.890 -        gamma_saved = (WORD *) SDL_malloc (3 * 256 * sizeof (*gamma_saved));
   1.891 +        gamma_saved = (WORD *) SDL_malloc(3 * 256 * sizeof(*gamma_saved));
   1.892          if (!gamma_saved) {
   1.893 -            SDL_OutOfMemory ();
   1.894 +            SDL_OutOfMemory();
   1.895              return -1;
   1.896          }
   1.897 -        hdc = GetDC (SDL_Window);
   1.898 -        GetDeviceGammaRamp (hdc, gamma_saved);
   1.899 -        ReleaseDC (SDL_Window, hdc);
   1.900 +        hdc = GetDC(SDL_Window);
   1.901 +        GetDeviceGammaRamp(hdc, gamma_saved);
   1.902 +        ReleaseDC(SDL_Window, hdc);
   1.903      }
   1.904 -    if (SDL_GetAppState () & SDL_APPINPUTFOCUS) {
   1.905 -        hdc = GetDC (SDL_Window);
   1.906 -        succeeded = SetDeviceGammaRamp (hdc, ramp);
   1.907 -        ReleaseDC (SDL_Window, hdc);
   1.908 +    if (SDL_GetAppState() & SDL_APPINPUTFOCUS) {
   1.909 +        hdc = GetDC(SDL_Window);
   1.910 +        succeeded = SetDeviceGammaRamp(hdc, ramp);
   1.911 +        ReleaseDC(SDL_Window, hdc);
   1.912      } else {
   1.913          succeeded = TRUE;
   1.914      }
   1.915 @@ -1031,25 +1030,25 @@
   1.916  }
   1.917  
   1.918  int
   1.919 -DIB_GetGammaRamp (_THIS, Uint16 * ramp)
   1.920 +DIB_GetGammaRamp(_THIS, Uint16 * ramp)
   1.921  {
   1.922  #ifdef NO_GAMMA_SUPPORT
   1.923 -    SDL_SetError ("SDL compiled without gamma ramp support");
   1.924 +    SDL_SetError("SDL compiled without gamma ramp support");
   1.925      return -1;
   1.926  #else
   1.927      HDC hdc;
   1.928      BOOL succeeded;
   1.929  
   1.930      /* Get the ramp from the display */
   1.931 -    hdc = GetDC (SDL_Window);
   1.932 -    succeeded = GetDeviceGammaRamp (hdc, ramp);
   1.933 -    ReleaseDC (SDL_Window, hdc);
   1.934 +    hdc = GetDC(SDL_Window);
   1.935 +    succeeded = GetDeviceGammaRamp(hdc, ramp);
   1.936 +    ReleaseDC(SDL_Window, hdc);
   1.937      return succeeded ? 0 : -1;
   1.938  #endif /* !NO_GAMMA_SUPPORT */
   1.939  }
   1.940  
   1.941  void
   1.942 -DIB_VideoQuit (_THIS)
   1.943 +DIB_VideoQuit(_THIS)
   1.944  {
   1.945      /* Destroy the window and everything associated with it */
   1.946      if (SDL_Window) {
   1.947 @@ -1057,25 +1056,25 @@
   1.948          if (this->screen) {
   1.949  #ifndef NO_CHANGEDISPLAYSETTINGS
   1.950              if (this->screen->flags & SDL_FULLSCREEN) {
   1.951 -                ChangeDisplaySettings (NULL, 0);
   1.952 -                ShowWindow (SDL_Window, SW_HIDE);
   1.953 +                ChangeDisplaySettings(NULL, 0);
   1.954 +                ShowWindow(SDL_Window, SW_HIDE);
   1.955              }
   1.956  #endif
   1.957              if (this->screen->flags & SDL_INTERNALOPENGL) {
   1.958 -                WIN_GL_ShutDown (this);
   1.959 +                WIN_GL_ShutDown(this);
   1.960              }
   1.961              this->screen->pixels = NULL;
   1.962          }
   1.963          if (screen_bmp) {
   1.964 -            DeleteObject (screen_bmp);
   1.965 +            DeleteObject(screen_bmp);
   1.966              screen_bmp = NULL;
   1.967          }
   1.968          if (screen_icn) {
   1.969 -            DestroyIcon (screen_icn);
   1.970 +            DestroyIcon(screen_icn);
   1.971              screen_icn = NULL;
   1.972          }
   1.973 -        DIB_QuitGamma (this);
   1.974 -        DIB_DestroyWindow (this);
   1.975 +        DIB_QuitGamma(this);
   1.976 +        DIB_DestroyWindow(this);
   1.977  
   1.978          SDL_Window = NULL;
   1.979  
   1.980 @@ -1083,7 +1082,7 @@
   1.981  
   1.982  // Unload wince aygshell library to prevent leak
   1.983          if (aygshell) {
   1.984 -            FreeLibrary (aygshell);
   1.985 +            FreeLibrary(aygshell);
   1.986              aygshell = NULL;
   1.987          }
   1.988  #endif
   1.989 @@ -1093,51 +1092,51 @@
   1.990  
   1.991  /* Exported for the windows message loop only */
   1.992  static void
   1.993 -DIB_FocusPalette (_THIS, int foreground)
   1.994 +DIB_FocusPalette(_THIS, int foreground)
   1.995  {
   1.996      if (screen_pal != NULL) {
   1.997          HDC hdc;
   1.998  
   1.999 -        hdc = GetDC (SDL_Window);
  1.1000 -        SelectPalette (hdc, screen_pal, FALSE);
  1.1001 -        if (RealizePalette (hdc))
  1.1002 -            InvalidateRect (SDL_Window, NULL, FALSE);
  1.1003 -        ReleaseDC (SDL_Window, hdc);
  1.1004 +        hdc = GetDC(SDL_Window);
  1.1005 +        SelectPalette(hdc, screen_pal, FALSE);
  1.1006 +        if (RealizePalette(hdc))
  1.1007 +            InvalidateRect(SDL_Window, NULL, FALSE);
  1.1008 +        ReleaseDC(SDL_Window, hdc);
  1.1009      }
  1.1010  }
  1.1011  static void
  1.1012 -DIB_RealizePalette (_THIS)
  1.1013 +DIB_RealizePalette(_THIS)
  1.1014  {
  1.1015 -    DIB_FocusPalette (this, 1);
  1.1016 +    DIB_FocusPalette(this, 1);
  1.1017  }
  1.1018  static void
  1.1019 -DIB_PaletteChanged (_THIS, HWND window)
  1.1020 +DIB_PaletteChanged(_THIS, HWND window)
  1.1021  {
  1.1022      if (window != SDL_Window) {
  1.1023 -        DIB_FocusPalette (this, 0);
  1.1024 +        DIB_FocusPalette(this, 0);
  1.1025      }
  1.1026  }
  1.1027  
  1.1028  /* Exported for the windows message loop only */
  1.1029  static void
  1.1030 -DIB_WinPAINT (_THIS, HDC hdc)
  1.1031 +DIB_WinPAINT(_THIS, HDC hdc)
  1.1032  {
  1.1033      HDC mdc;
  1.1034  
  1.1035      if (screen_pal) {
  1.1036 -        SelectPalette (hdc, screen_pal, FALSE);
  1.1037 +        SelectPalette(hdc, screen_pal, FALSE);
  1.1038      }
  1.1039 -    mdc = CreateCompatibleDC (hdc);
  1.1040 -    SelectObject (mdc, screen_bmp);
  1.1041 -    BitBlt (hdc, 0, 0, SDL_VideoSurface->w, SDL_VideoSurface->h,
  1.1042 -            mdc, 0, 0, SRCCOPY);
  1.1043 -    DeleteDC (mdc);
  1.1044 +    mdc = CreateCompatibleDC(hdc);
  1.1045 +    SelectObject(mdc, screen_bmp);
  1.1046 +    BitBlt(hdc, 0, 0, SDL_VideoSurface->w, SDL_VideoSurface->h,
  1.1047 +           mdc, 0, 0, SRCCOPY);
  1.1048 +    DeleteDC(mdc);
  1.1049  }
  1.1050  
  1.1051  /* Stub in case DirectX isn't available */
  1.1052  #if !SDL_AUDIO_DRIVER_DSOUND
  1.1053  void
  1.1054 -DX5_SoundFocus (HWND hwnd)
  1.1055 +DX5_SoundFocus(HWND hwnd)
  1.1056  {
  1.1057      return;
  1.1058  }