indent
authorSam Lantinga <slouken@libsdl.org>
Sun, 04 Jan 2009 17:14:27 +0000
changeset 2990502adab079a4
parent 2989 aba5a5cc2e63
child 2991 f4d14219c2aa
indent
include/SDL_video.h
src/events/SDL_keyboard.c
src/video/SDL_bmp.c
src/video/SDL_pixels.c
src/video/SDL_pixels_c.h
src/video/win32/SDL_d3drender.c
src/video/win32/SDL_win32events.c
src/video/win32/SDL_win32mouse.c
src/video/win32/SDL_win32window.c
src/video/x11/SDL_x11window.c
     1.1 --- a/include/SDL_video.h	Sun Jan 04 17:10:04 2009 +0000
     1.2 +++ b/include/SDL_video.h	Sun Jan 04 17:14:27 2009 +0000
     1.3 @@ -597,7 +597,8 @@
     1.4   *
     1.5   * \param icon The icon for the window
     1.6   */
     1.7 -extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_WindowID windowID, SDL_Surface * icon);
     1.8 +extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_WindowID windowID,
     1.9 +                                               SDL_Surface * icon);
    1.10  
    1.11  /**
    1.12   * \fn void SDL_SetWindowData(SDL_WindowID windowID, void *userdata)
     2.1 --- a/src/events/SDL_keyboard.c	Sun Jan 04 17:10:04 2009 +0000
     2.2 +++ b/src/events/SDL_keyboard.c	Sun Jan 04 17:14:27 2009 +0000
     2.3 @@ -975,17 +975,17 @@
     2.4  
     2.5      switch (key) {
     2.6      case SDLK_RETURN:
     2.7 -            return SDL_GetScancodeName(SDL_SCANCODE_RETURN);
     2.8 +        return SDL_GetScancodeName(SDL_SCANCODE_RETURN);
     2.9      case SDLK_ESCAPE:
    2.10 -            return SDL_GetScancodeName(SDL_SCANCODE_ESCAPE);
    2.11 +        return SDL_GetScancodeName(SDL_SCANCODE_ESCAPE);
    2.12      case SDLK_BACKSPACE:
    2.13 -            return SDL_GetScancodeName(SDL_SCANCODE_BACKSPACE);
    2.14 +        return SDL_GetScancodeName(SDL_SCANCODE_BACKSPACE);
    2.15      case SDLK_TAB:
    2.16 -            return SDL_GetScancodeName(SDL_SCANCODE_TAB);
    2.17 +        return SDL_GetScancodeName(SDL_SCANCODE_TAB);
    2.18      case SDLK_SPACE:
    2.19 -            return SDL_GetScancodeName(SDL_SCANCODE_SPACE);
    2.20 +        return SDL_GetScancodeName(SDL_SCANCODE_SPACE);
    2.21      case SDLK_DELETE:
    2.22 -            return SDL_GetScancodeName(SDL_SCANCODE_DELETE);
    2.23 +        return SDL_GetScancodeName(SDL_SCANCODE_DELETE);
    2.24      default:
    2.25          /* Unaccented letter keys on latin keyboards are normally
    2.26             labeled in upper case (and probably on others like Greek or
     3.1 --- a/src/video/SDL_bmp.c	Sun Jan 04 17:10:04 2009 +0000
     3.2 +++ b/src/video/SDL_bmp.c	Sun Jan 04 17:14:27 2009 +0000
     3.3 @@ -412,7 +412,8 @@
     3.4                 32-bit BMP with alpha channel, otherwise save a 24-bit BMP. */
     3.5              if (save32bit) {
     3.6                  SDL_InitFormat(&format, 32,
     3.7 -                               0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
     3.8 +                               0x00FF0000, 0x0000FF00, 0x000000FF,
     3.9 +                               0xFF000000);
    3.10              } else {
    3.11                  SDL_InitFormat(&format, 24,
    3.12  #if SDL_BYTEORDER == SDL_LIL_ENDIAN
    3.13 @@ -424,7 +425,8 @@
    3.14              }
    3.15              surface = SDL_ConvertSurface(saveme, &format, 0);
    3.16              if (!surface) {
    3.17 -                SDL_SetError("Couldn't convert image to %d bpp", format.BitsPerPixel);
    3.18 +                SDL_SetError("Couldn't convert image to %d bpp",
    3.19 +                             format.BitsPerPixel);
    3.20              }
    3.21          }
    3.22      }
     4.1 --- a/src/video/SDL_pixels.c	Sun Jan 04 17:10:04 2009 +0000
     4.2 +++ b/src/video/SDL_pixels.c	Sun Jan 04 17:14:27 2009 +0000
     4.3 @@ -360,7 +360,8 @@
     4.4  }
     4.5  
     4.6  SDL_PixelFormat *
     4.7 -SDL_InitFormat(SDL_PixelFormat *format, int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
     4.8 +SDL_InitFormat(SDL_PixelFormat * format, int bpp, Uint32 Rmask, Uint32 Gmask,
     4.9 +               Uint32 Bmask, Uint32 Amask)
    4.10  {
    4.11      Uint32 mask;
    4.12  
     5.1 --- a/src/video/SDL_pixels_c.h	Sun Jan 04 17:10:04 2009 +0000
     5.2 +++ b/src/video/SDL_pixels_c.h	Sun Jan 04 17:14:27 2009 +0000
     5.3 @@ -29,9 +29,9 @@
     5.4  extern SDL_PixelFormat *SDL_AllocFormat(int bpp,
     5.5                                          Uint32 Rmask, Uint32 Gmask,
     5.6                                          Uint32 Bmask, Uint32 Amask);
     5.7 -extern SDL_PixelFormat *SDL_InitFormat(SDL_PixelFormat *format, int bpp,
     5.8 -                                        Uint32 Rmask, Uint32 Gmask,
     5.9 -                                        Uint32 Bmask, Uint32 Amask);
    5.10 +extern SDL_PixelFormat *SDL_InitFormat(SDL_PixelFormat * format, int bpp,
    5.11 +                                       Uint32 Rmask, Uint32 Gmask,
    5.12 +                                       Uint32 Bmask, Uint32 Amask);
    5.13  extern void SDL_FormatChanged(SDL_Surface * surface);
    5.14  extern void SDL_FreeFormat(SDL_PixelFormat * format);
    5.15  
     6.1 --- a/src/video/win32/SDL_d3drender.c	Sun Jan 04 17:10:04 2009 +0000
     6.2 +++ b/src/video/win32/SDL_d3drender.c	Sun Jan 04 17:14:27 2009 +0000
     6.3 @@ -39,7 +39,9 @@
     6.4  static SDL_Renderer *D3D_CreateRenderer(SDL_Window * window, Uint32 flags);
     6.5  static int D3D_DisplayModeChanged(SDL_Renderer * renderer);
     6.6  static int D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
     6.7 -static int D3D_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture, void **pixels, int *pitch);
     6.8 +static int D3D_QueryTexturePixels(SDL_Renderer * renderer,
     6.9 +                                  SDL_Texture * texture, void **pixels,
    6.10 +                                  int *pitch);
    6.11  static int D3D_SetTexturePalette(SDL_Renderer * renderer,
    6.12                                   SDL_Texture * texture,
    6.13                                   const SDL_Color * colors, int firstcolor,
    6.14 @@ -232,17 +234,18 @@
    6.15  }
    6.16  
    6.17  static SDL_bool
    6.18 -D3D_IsTextureFormatAvailable(IDirect3D9 *d3d, Uint32 display_format, Uint32 texture_format)
    6.19 +D3D_IsTextureFormatAvailable(IDirect3D9 * d3d, Uint32 display_format,
    6.20 +                             Uint32 texture_format)
    6.21  {
    6.22      HRESULT result;
    6.23  
    6.24 -    result = IDirect3D9_CheckDeviceFormat(d3d,
    6.25 -                                          D3DADAPTER_DEFAULT,        /* FIXME */
    6.26 +    result = IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT,      /* FIXME */
    6.27                                            D3DDEVTYPE_HAL,
    6.28                                            PixelFormatToD3DFMT(display_format),
    6.29                                            0,
    6.30                                            D3DRTYPE_TEXTURE,
    6.31 -                                          PixelFormatToD3DFMT(texture_format));
    6.32 +                                          PixelFormatToD3DFMT
    6.33 +                                          (texture_format));
    6.34      return FAILED(result) ? SDL_FALSE : SDL_TRUE;
    6.35  }
    6.36  
    6.37 @@ -260,7 +263,8 @@
    6.38      d3drect.top = 0;
    6.39      d3drect.bottom = texture->h;
    6.40  
    6.41 -    result = IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0);
    6.42 +    result =
    6.43 +        IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0);
    6.44      if (FAILED(result)) {
    6.45          return;
    6.46      }
    6.47 @@ -285,28 +289,35 @@
    6.48      if (data->d3d) {
    6.49          int i;
    6.50          int formats[] = {
    6.51 -          SDL_PIXELFORMAT_INDEX8,
    6.52 -          SDL_PIXELFORMAT_RGB332,
    6.53 -          SDL_PIXELFORMAT_RGB444,
    6.54 -          SDL_PIXELFORMAT_RGB555,
    6.55 -          SDL_PIXELFORMAT_ARGB4444,
    6.56 -          SDL_PIXELFORMAT_ARGB1555,
    6.57 -          SDL_PIXELFORMAT_RGB565,
    6.58 -          SDL_PIXELFORMAT_RGB888,
    6.59 -          SDL_PIXELFORMAT_ARGB8888,
    6.60 -          SDL_PIXELFORMAT_ARGB2101010,
    6.61 +            SDL_PIXELFORMAT_INDEX8,
    6.62 +            SDL_PIXELFORMAT_RGB332,
    6.63 +            SDL_PIXELFORMAT_RGB444,
    6.64 +            SDL_PIXELFORMAT_RGB555,
    6.65 +            SDL_PIXELFORMAT_ARGB4444,
    6.66 +            SDL_PIXELFORMAT_ARGB1555,
    6.67 +            SDL_PIXELFORMAT_RGB565,
    6.68 +            SDL_PIXELFORMAT_RGB888,
    6.69 +            SDL_PIXELFORMAT_ARGB8888,
    6.70 +            SDL_PIXELFORMAT_ARGB2101010,
    6.71          };
    6.72  
    6.73          for (i = 0; i < SDL_arraysize(formats); ++i) {
    6.74 -            if (D3D_IsTextureFormatAvailable(data->d3d, mode->format, formats[i])) {
    6.75 -                info->texture_formats[info->num_texture_formats++] = formats[i];
    6.76 +            if (D3D_IsTextureFormatAvailable
    6.77 +                (data->d3d, mode->format, formats[i])) {
    6.78 +                info->texture_formats[info->num_texture_formats++] =
    6.79 +                    formats[i];
    6.80              }
    6.81          }
    6.82 -        info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_YV12;
    6.83 -        info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_IYUV;
    6.84 -        info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_YUY2;
    6.85 -        info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_UYVY;
    6.86 -        info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_YVYU;
    6.87 +        info->texture_formats[info->num_texture_formats++] =
    6.88 +            SDL_PIXELFORMAT_YV12;
    6.89 +        info->texture_formats[info->num_texture_formats++] =
    6.90 +            SDL_PIXELFORMAT_IYUV;
    6.91 +        info->texture_formats[info->num_texture_formats++] =
    6.92 +            SDL_PIXELFORMAT_YUY2;
    6.93 +        info->texture_formats[info->num_texture_formats++] =
    6.94 +            SDL_PIXELFORMAT_UYVY;
    6.95 +        info->texture_formats[info->num_texture_formats++] =
    6.96 +            SDL_PIXELFORMAT_YVYU;
    6.97  
    6.98          SDL_AddRenderDriver(0, &D3D_RenderDriver);
    6.99      }
   6.100 @@ -549,9 +560,11 @@
   6.101  
   6.102      if (SDL_ISPIXELFORMAT_FOURCC(texture->format) &&
   6.103          (texture->format != SDL_PIXELFORMAT_YUY2 ||
   6.104 -         !D3D_IsTextureFormatAvailable(renderdata->d3d, display_format, texture->format)) &&
   6.105 -        (texture->format != SDL_PIXELFORMAT_YVYU ||
   6.106 -         !D3D_IsTextureFormatAvailable(renderdata->d3d, display_format, texture->format))) {
   6.107 +         !D3D_IsTextureFormatAvailable(renderdata->d3d, display_format,
   6.108 +                                       texture->format))
   6.109 +        && (texture->format != SDL_PIXELFORMAT_YVYU
   6.110 +            || !D3D_IsTextureFormatAvailable(renderdata->d3d, display_format,
   6.111 +                                             texture->format))) {
   6.112          data->yuv =
   6.113              SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h);
   6.114          if (!data->yuv) {
   6.115 @@ -680,7 +693,8 @@
   6.116          result =
   6.117              IDirect3DDevice9_CreateTexture(renderdata->device, texture->w,
   6.118                                             texture->h, 1, 0,
   6.119 -                                           PixelFormatToD3DFMT(texture->format),
   6.120 +                                           PixelFormatToD3DFMT(texture->
   6.121 +                                                               format),
   6.122                                             D3DPOOL_SYSTEMMEM, &temp, NULL);
   6.123          if (FAILED(result)) {
   6.124              D3D_SetError("CreateTexture()", result);
   6.125 @@ -733,7 +747,8 @@
   6.126          d3drect.bottom = rect->y + rect->h;
   6.127  
   6.128          result =
   6.129 -            IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0);
   6.130 +            IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect,
   6.131 +                                       0);
   6.132          if (FAILED(result)) {
   6.133              D3D_SetError("LockRect()", result);
   6.134              return -1;
   6.135 @@ -776,7 +791,8 @@
   6.136  
   6.137          result =
   6.138              IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect,
   6.139 -                                       markDirty ? 0 : D3DLOCK_NO_DIRTY_UPDATE);
   6.140 +                                       markDirty ? 0 :
   6.141 +                                       D3DLOCK_NO_DIRTY_UPDATE);
   6.142          if (FAILED(result)) {
   6.143              D3D_SetError("LockRect()", result);
   6.144              return -1;
     7.1 --- a/src/video/win32/SDL_win32events.c	Sun Jan 04 17:10:04 2009 +0000
     7.2 +++ b/src/video/win32/SDL_win32events.c	Sun Jan 04 17:14:27 2009 +0000
     7.3 @@ -287,7 +287,7 @@
     7.4              }
     7.5              if (flags & RI_MOUSE_WHEEL) {
     7.6                  SDL_SendMouseWheel(index, 0,
     7.7 -                                   (short)raw->data.mouse.usButtonData);
     7.8 +                                   (short) raw->data.mouse.usButtonData);
     7.9              }
    7.10              SDL_stack_free(lpb);
    7.11          }
     8.1 --- a/src/video/win32/SDL_win32mouse.c	Sun Jan 04 17:10:04 2009 +0000
     8.2 +++ b/src/video/win32/SDL_win32mouse.c	Sun Jan 04 17:14:27 2009 +0000
     8.3 @@ -85,7 +85,8 @@
     8.4              continue;
     8.5          }
     8.6          buffer = SDL_malloc((tmp + 1) * sizeof(char));
     8.7 -        key_name = SDL_malloc((tmp + SDL_strlen(reg_key_root) + 1) * sizeof(char));
     8.8 +        key_name =
     8.9 +            SDL_malloc((tmp + SDL_strlen(reg_key_root) + 1) * sizeof(char));
    8.10  
    8.11          /* we're getting the device registry path and polishing it to get it's name,
    8.12             surely there must be an easier way, but we haven't found it yet */
    8.13 @@ -126,7 +127,7 @@
    8.14              }
    8.15          }
    8.16  
    8.17 -		buffer -= 4;
    8.18 +        buffer -= 4;
    8.19  
    8.20          if (is_rdp == 1) {
    8.21              SDL_free(buffer);
    8.22 @@ -178,7 +179,8 @@
    8.23              int cursors;
    8.24              data->WTInfoA(WTI_DEVICES, DVC_NPRESSURE, &pressure);
    8.25              data->WTInfoA(WTI_DEVICES, DVC_NCSRTYPES, &cursors);
    8.26 -            SDL_AddMouse(&mouse, device_name, pressure.axMax, pressure.axMin, cursors);
    8.27 +            SDL_AddMouse(&mouse, device_name, pressure.axMax, pressure.axMin,
    8.28 +                         cursors);
    8.29          } else {
    8.30              SDL_AddMouse(&mouse, device_name, 0, 0, 1);
    8.31          }
     9.1 --- a/src/video/win32/SDL_win32window.c	Sun Jan 04 17:10:04 2009 +0000
     9.2 +++ b/src/video/win32/SDL_win32window.c	Sun Jan 04 17:14:27 2009 +0000
     9.3 @@ -318,7 +318,7 @@
     9.4      HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
     9.5      HICON hicon = NULL;
     9.6  
     9.7 -    if(icon) {
     9.8 +    if (icon) {
     9.9          BYTE *icon_bmp;
    9.10          int icon_len;
    9.11          SDL_RWops *dst;
    9.12 @@ -337,7 +337,7 @@
    9.13          /* Write the BITMAPINFO header */
    9.14          SDL_WriteLE32(dst, 40);
    9.15          SDL_WriteLE32(dst, icon->w);
    9.16 -        SDL_WriteLE32(dst, icon->h*2);
    9.17 +        SDL_WriteLE32(dst, icon->h * 2);
    9.18          SDL_WriteLE16(dst, 1);
    9.19          SDL_WriteLE16(dst, 32);
    9.20          SDL_WriteLE32(dst, BI_RGB);
    9.21 @@ -355,22 +355,23 @@
    9.22              /* Write the pixels upside down into the bitmap buffer */
    9.23              int y = surface->h;
    9.24              while (y--) {
    9.25 -                Uint8 *src = (Uint8 *)surface->pixels + y * surface->pitch;
    9.26 +                Uint8 *src = (Uint8 *) surface->pixels + y * surface->pitch;
    9.27                  SDL_RWwrite(dst, src, surface->pitch, 1);
    9.28              }
    9.29              SDL_FreeSurface(surface);
    9.30  
    9.31 -            hicon = CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000);
    9.32 +            hicon =
    9.33 +                CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000);
    9.34          }
    9.35          SDL_RWclose(dst);
    9.36          SDL_stack_free(icon_bmp);
    9.37      }
    9.38  
    9.39      /* Set the icon for the window */
    9.40 -    SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hicon);
    9.41 +    SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM) hicon);
    9.42  
    9.43      /* Set the icon in the task manager (should we do this?) */
    9.44 -    SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hicon);
    9.45 +    SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM) hicon);
    9.46  }
    9.47  
    9.48  void
    10.1 --- a/src/video/x11/SDL_x11window.c	Sun Jan 04 17:10:04 2009 +0000
    10.2 +++ b/src/video/x11/SDL_x11window.c	Sun Jan 04 17:14:27 2009 +0000
    10.3 @@ -659,22 +659,24 @@
    10.4          Uint32 *propdata;
    10.5  
    10.6          /* Convert the icon to ARGB for modern window managers */
    10.7 -        SDL_InitFormat(&format, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
    10.8 +        SDL_InitFormat(&format, 32, 0x00FF0000, 0x0000FF00, 0x000000FF,
    10.9 +                       0xFF000000);
   10.10          surface = SDL_ConvertSurface(icon, &format, 0);
   10.11          if (!surface) {
   10.12              return;
   10.13          }
   10.14  
   10.15          /* Set the _NET_WM_ICON property */
   10.16 -        propsize = 2+(icon->w*icon->h);
   10.17 +        propsize = 2 + (icon->w * icon->h);
   10.18          propdata = SDL_malloc(propsize * sizeof(Uint32));
   10.19          if (propdata) {
   10.20              propdata[0] = icon->w;
   10.21              propdata[1] = icon->h;
   10.22 -            SDL_memcpy(&propdata[2], surface->pixels, surface->h*surface->pitch);
   10.23 -            XChangeProperty(display, data->window, _NET_WM_ICON, 
   10.24 -                            XA_CARDINAL, 32, PropModeReplace,
   10.25 -                            (unsigned char *) propdata, propsize);
   10.26 +            SDL_memcpy(&propdata[2], surface->pixels,
   10.27 +                       surface->h * surface->pitch);
   10.28 +            XChangeProperty(display, data->window, _NET_WM_ICON, XA_CARDINAL,
   10.29 +                            32, PropModeReplace, (unsigned char *) propdata,
   10.30 +                            propsize);
   10.31          }
   10.32          SDL_FreeSurface(surface);
   10.33      } else {