Commit 1b9b4083 authored by Sam Lantinga's avatar Sam Lantinga

indent

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403452
parent ff8b5276
...@@ -597,7 +597,8 @@ extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_WindowID windowID); ...@@ -597,7 +597,8 @@ extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_WindowID windowID);
* *
* \param icon The icon for the window * \param icon The icon for the window
*/ */
extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_WindowID windowID, SDL_Surface * icon); extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_WindowID windowID,
SDL_Surface * icon);
/** /**
* \fn void SDL_SetWindowData(SDL_WindowID windowID, void *userdata) * \fn void SDL_SetWindowData(SDL_WindowID windowID, void *userdata)
......
...@@ -975,17 +975,17 @@ SDL_GetKeyName(SDLKey key) ...@@ -975,17 +975,17 @@ SDL_GetKeyName(SDLKey key)
switch (key) { switch (key) {
case SDLK_RETURN: case SDLK_RETURN:
return SDL_GetScancodeName(SDL_SCANCODE_RETURN); return SDL_GetScancodeName(SDL_SCANCODE_RETURN);
case SDLK_ESCAPE: case SDLK_ESCAPE:
return SDL_GetScancodeName(SDL_SCANCODE_ESCAPE); return SDL_GetScancodeName(SDL_SCANCODE_ESCAPE);
case SDLK_BACKSPACE: case SDLK_BACKSPACE:
return SDL_GetScancodeName(SDL_SCANCODE_BACKSPACE); return SDL_GetScancodeName(SDL_SCANCODE_BACKSPACE);
case SDLK_TAB: case SDLK_TAB:
return SDL_GetScancodeName(SDL_SCANCODE_TAB); return SDL_GetScancodeName(SDL_SCANCODE_TAB);
case SDLK_SPACE: case SDLK_SPACE:
return SDL_GetScancodeName(SDL_SCANCODE_SPACE); return SDL_GetScancodeName(SDL_SCANCODE_SPACE);
case SDLK_DELETE: case SDLK_DELETE:
return SDL_GetScancodeName(SDL_SCANCODE_DELETE); return SDL_GetScancodeName(SDL_SCANCODE_DELETE);
default: default:
/* Unaccented letter keys on latin keyboards are normally /* Unaccented letter keys on latin keyboards are normally
labeled in upper case (and probably on others like Greek or labeled in upper case (and probably on others like Greek or
......
...@@ -412,7 +412,8 @@ SDL_SaveBMP_RW(SDL_Surface * saveme, SDL_RWops * dst, int freedst) ...@@ -412,7 +412,8 @@ SDL_SaveBMP_RW(SDL_Surface * saveme, SDL_RWops * dst, int freedst)
32-bit BMP with alpha channel, otherwise save a 24-bit BMP. */ 32-bit BMP with alpha channel, otherwise save a 24-bit BMP. */
if (save32bit) { if (save32bit) {
SDL_InitFormat(&format, 32, SDL_InitFormat(&format, 32,
0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000); 0x00FF0000, 0x0000FF00, 0x000000FF,
0xFF000000);
} else { } else {
SDL_InitFormat(&format, 24, SDL_InitFormat(&format, 24,
#if SDL_BYTEORDER == SDL_LIL_ENDIAN #if SDL_BYTEORDER == SDL_LIL_ENDIAN
...@@ -424,7 +425,8 @@ SDL_SaveBMP_RW(SDL_Surface * saveme, SDL_RWops * dst, int freedst) ...@@ -424,7 +425,8 @@ SDL_SaveBMP_RW(SDL_Surface * saveme, SDL_RWops * dst, int freedst)
} }
surface = SDL_ConvertSurface(saveme, &format, 0); surface = SDL_ConvertSurface(saveme, &format, 0);
if (!surface) { if (!surface) {
SDL_SetError("Couldn't convert image to %d bpp", format.BitsPerPixel); SDL_SetError("Couldn't convert image to %d bpp",
format.BitsPerPixel);
} }
} }
} }
......
...@@ -360,7 +360,8 @@ SDL_AllocFormat(int bpp, ...@@ -360,7 +360,8 @@ SDL_AllocFormat(int bpp,
} }
SDL_PixelFormat * SDL_PixelFormat *
SDL_InitFormat(SDL_PixelFormat *format, int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) SDL_InitFormat(SDL_PixelFormat * format, int bpp, Uint32 Rmask, Uint32 Gmask,
Uint32 Bmask, Uint32 Amask)
{ {
Uint32 mask; Uint32 mask;
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
extern SDL_PixelFormat *SDL_AllocFormat(int bpp, extern SDL_PixelFormat *SDL_AllocFormat(int bpp,
Uint32 Rmask, Uint32 Gmask, Uint32 Rmask, Uint32 Gmask,
Uint32 Bmask, Uint32 Amask); Uint32 Bmask, Uint32 Amask);
extern SDL_PixelFormat *SDL_InitFormat(SDL_PixelFormat *format, int bpp, extern SDL_PixelFormat *SDL_InitFormat(SDL_PixelFormat * format, int bpp,
Uint32 Rmask, Uint32 Gmask, Uint32 Rmask, Uint32 Gmask,
Uint32 Bmask, Uint32 Amask); Uint32 Bmask, Uint32 Amask);
extern void SDL_FormatChanged(SDL_Surface * surface); extern void SDL_FormatChanged(SDL_Surface * surface);
extern void SDL_FreeFormat(SDL_PixelFormat * format); extern void SDL_FreeFormat(SDL_PixelFormat * format);
......
...@@ -39,7 +39,9 @@ ...@@ -39,7 +39,9 @@
static SDL_Renderer *D3D_CreateRenderer(SDL_Window * window, Uint32 flags); static SDL_Renderer *D3D_CreateRenderer(SDL_Window * window, Uint32 flags);
static int D3D_DisplayModeChanged(SDL_Renderer * renderer); static int D3D_DisplayModeChanged(SDL_Renderer * renderer);
static int D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static int D3D_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture, void **pixels, int *pitch); static int D3D_QueryTexturePixels(SDL_Renderer * renderer,
SDL_Texture * texture, void **pixels,
int *pitch);
static int D3D_SetTexturePalette(SDL_Renderer * renderer, static int D3D_SetTexturePalette(SDL_Renderer * renderer,
SDL_Texture * texture, SDL_Texture * texture,
const SDL_Color * colors, int firstcolor, const SDL_Color * colors, int firstcolor,
...@@ -232,17 +234,18 @@ PixelFormatToD3DFMT(Uint32 format) ...@@ -232,17 +234,18 @@ PixelFormatToD3DFMT(Uint32 format)
} }
static SDL_bool static SDL_bool
D3D_IsTextureFormatAvailable(IDirect3D9 *d3d, Uint32 display_format, Uint32 texture_format) D3D_IsTextureFormatAvailable(IDirect3D9 * d3d, Uint32 display_format,
Uint32 texture_format)
{ {
HRESULT result; HRESULT result;
result = IDirect3D9_CheckDeviceFormat(d3d, result = IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, /* FIXME */
D3DADAPTER_DEFAULT, /* FIXME */
D3DDEVTYPE_HAL, D3DDEVTYPE_HAL,
PixelFormatToD3DFMT(display_format), PixelFormatToD3DFMT(display_format),
0, 0,
D3DRTYPE_TEXTURE, D3DRTYPE_TEXTURE,
PixelFormatToD3DFMT(texture_format)); PixelFormatToD3DFMT
(texture_format));
return FAILED(result) ? SDL_FALSE : SDL_TRUE; return FAILED(result) ? SDL_FALSE : SDL_TRUE;
} }
...@@ -260,7 +263,8 @@ UpdateYUVTextureData(SDL_Texture * texture) ...@@ -260,7 +263,8 @@ UpdateYUVTextureData(SDL_Texture * texture)
d3drect.top = 0; d3drect.top = 0;
d3drect.bottom = texture->h; d3drect.bottom = texture->h;
result = IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0); result =
IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0);
if (FAILED(result)) { if (FAILED(result)) {
return; return;
} }
...@@ -285,28 +289,35 @@ D3D_AddRenderDriver(_THIS) ...@@ -285,28 +289,35 @@ D3D_AddRenderDriver(_THIS)
if (data->d3d) { if (data->d3d) {
int i; int i;
int formats[] = { int formats[] = {
SDL_PIXELFORMAT_INDEX8, SDL_PIXELFORMAT_INDEX8,
SDL_PIXELFORMAT_RGB332, SDL_PIXELFORMAT_RGB332,
SDL_PIXELFORMAT_RGB444, SDL_PIXELFORMAT_RGB444,
SDL_PIXELFORMAT_RGB555, SDL_PIXELFORMAT_RGB555,
SDL_PIXELFORMAT_ARGB4444, SDL_PIXELFORMAT_ARGB4444,
SDL_PIXELFORMAT_ARGB1555, SDL_PIXELFORMAT_ARGB1555,
SDL_PIXELFORMAT_RGB565, SDL_PIXELFORMAT_RGB565,
SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888,
SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888,
SDL_PIXELFORMAT_ARGB2101010, SDL_PIXELFORMAT_ARGB2101010,
}; };
for (i = 0; i < SDL_arraysize(formats); ++i) { for (i = 0; i < SDL_arraysize(formats); ++i) {
if (D3D_IsTextureFormatAvailable(data->d3d, mode->format, formats[i])) { if (D3D_IsTextureFormatAvailable
info->texture_formats[info->num_texture_formats++] = formats[i]; (data->d3d, mode->format, formats[i])) {
info->texture_formats[info->num_texture_formats++] =
formats[i];
} }
} }
info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_YV12; info->texture_formats[info->num_texture_formats++] =
info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_IYUV; SDL_PIXELFORMAT_YV12;
info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_YUY2; info->texture_formats[info->num_texture_formats++] =
info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_UYVY; SDL_PIXELFORMAT_IYUV;
info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_YVYU; info->texture_formats[info->num_texture_formats++] =
SDL_PIXELFORMAT_YUY2;
info->texture_formats[info->num_texture_formats++] =
SDL_PIXELFORMAT_UYVY;
info->texture_formats[info->num_texture_formats++] =
SDL_PIXELFORMAT_YVYU;
SDL_AddRenderDriver(0, &D3D_RenderDriver); SDL_AddRenderDriver(0, &D3D_RenderDriver);
} }
...@@ -549,9 +560,11 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -549,9 +560,11 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
if (SDL_ISPIXELFORMAT_FOURCC(texture->format) && if (SDL_ISPIXELFORMAT_FOURCC(texture->format) &&
(texture->format != SDL_PIXELFORMAT_YUY2 || (texture->format != SDL_PIXELFORMAT_YUY2 ||
!D3D_IsTextureFormatAvailable(renderdata->d3d, display_format, texture->format)) && !D3D_IsTextureFormatAvailable(renderdata->d3d, display_format,
(texture->format != SDL_PIXELFORMAT_YVYU || texture->format))
!D3D_IsTextureFormatAvailable(renderdata->d3d, display_format, texture->format))) { && (texture->format != SDL_PIXELFORMAT_YVYU
|| !D3D_IsTextureFormatAvailable(renderdata->d3d, display_format,
texture->format))) {
data->yuv = data->yuv =
SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h); SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h);
if (!data->yuv) { if (!data->yuv) {
...@@ -680,7 +693,8 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -680,7 +693,8 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
result = result =
IDirect3DDevice9_CreateTexture(renderdata->device, texture->w, IDirect3DDevice9_CreateTexture(renderdata->device, texture->w,
texture->h, 1, 0, texture->h, 1, 0,
PixelFormatToD3DFMT(texture->format), PixelFormatToD3DFMT(texture->
format),
D3DPOOL_SYSTEMMEM, &temp, NULL); D3DPOOL_SYSTEMMEM, &temp, NULL);
if (FAILED(result)) { if (FAILED(result)) {
D3D_SetError("CreateTexture()", result); D3D_SetError("CreateTexture()", result);
...@@ -733,7 +747,8 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -733,7 +747,8 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
d3drect.bottom = rect->y + rect->h; d3drect.bottom = rect->y + rect->h;
result = result =
IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0); IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect,
0);
if (FAILED(result)) { if (FAILED(result)) {
D3D_SetError("LockRect()", result); D3D_SetError("LockRect()", result);
return -1; return -1;
...@@ -776,7 +791,8 @@ D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -776,7 +791,8 @@ D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
result = result =
IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect,
markDirty ? 0 : D3DLOCK_NO_DIRTY_UPDATE); markDirty ? 0 :
D3DLOCK_NO_DIRTY_UPDATE);
if (FAILED(result)) { if (FAILED(result)) {
D3D_SetError("LockRect()", result); D3D_SetError("LockRect()", result);
return -1; return -1;
......
...@@ -287,7 +287,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -287,7 +287,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
} }
if (flags & RI_MOUSE_WHEEL) { if (flags & RI_MOUSE_WHEEL) {
SDL_SendMouseWheel(index, 0, SDL_SendMouseWheel(index, 0,
(short)raw->data.mouse.usButtonData); (short) raw->data.mouse.usButtonData);
} }
SDL_stack_free(lpb); SDL_stack_free(lpb);
} }
......
...@@ -85,7 +85,8 @@ WIN_InitMouse(_THIS) ...@@ -85,7 +85,8 @@ WIN_InitMouse(_THIS)
continue; continue;
} }
buffer = SDL_malloc((tmp + 1) * sizeof(char)); buffer = SDL_malloc((tmp + 1) * sizeof(char));
key_name = SDL_malloc((tmp + SDL_strlen(reg_key_root) + 1) * sizeof(char)); key_name =
SDL_malloc((tmp + SDL_strlen(reg_key_root) + 1) * sizeof(char));
/* we're getting the device registry path and polishing it to get it's name, /* we're getting the device registry path and polishing it to get it's name,
surely there must be an easier way, but we haven't found it yet */ surely there must be an easier way, but we haven't found it yet */
...@@ -126,7 +127,7 @@ WIN_InitMouse(_THIS) ...@@ -126,7 +127,7 @@ WIN_InitMouse(_THIS)
} }
} }
buffer -= 4; buffer -= 4;
if (is_rdp == 1) { if (is_rdp == 1) {
SDL_free(buffer); SDL_free(buffer);
...@@ -178,7 +179,8 @@ WIN_InitMouse(_THIS) ...@@ -178,7 +179,8 @@ WIN_InitMouse(_THIS)
int cursors; int cursors;
data->WTInfoA(WTI_DEVICES, DVC_NPRESSURE, &pressure); data->WTInfoA(WTI_DEVICES, DVC_NPRESSURE, &pressure);
data->WTInfoA(WTI_DEVICES, DVC_NCSRTYPES, &cursors); data->WTInfoA(WTI_DEVICES, DVC_NCSRTYPES, &cursors);
SDL_AddMouse(&mouse, device_name, pressure.axMax, pressure.axMin, cursors); SDL_AddMouse(&mouse, device_name, pressure.axMax, pressure.axMin,
cursors);
} else { } else {
SDL_AddMouse(&mouse, device_name, 0, 0, 1); SDL_AddMouse(&mouse, device_name, 0, 0, 1);
} }
......
...@@ -318,7 +318,7 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) ...@@ -318,7 +318,7 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
HICON hicon = NULL; HICON hicon = NULL;
if(icon) { if (icon) {
BYTE *icon_bmp; BYTE *icon_bmp;
int icon_len; int icon_len;
SDL_RWops *dst; SDL_RWops *dst;
...@@ -337,7 +337,7 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) ...@@ -337,7 +337,7 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
/* Write the BITMAPINFO header */ /* Write the BITMAPINFO header */
SDL_WriteLE32(dst, 40); SDL_WriteLE32(dst, 40);
SDL_WriteLE32(dst, icon->w); SDL_WriteLE32(dst, icon->w);
SDL_WriteLE32(dst, icon->h*2); SDL_WriteLE32(dst, icon->h * 2);
SDL_WriteLE16(dst, 1); SDL_WriteLE16(dst, 1);
SDL_WriteLE16(dst, 32); SDL_WriteLE16(dst, 32);
SDL_WriteLE32(dst, BI_RGB); SDL_WriteLE32(dst, BI_RGB);
...@@ -355,22 +355,23 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) ...@@ -355,22 +355,23 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
/* Write the pixels upside down into the bitmap buffer */ /* Write the pixels upside down into the bitmap buffer */
int y = surface->h; int y = surface->h;
while (y--) { while (y--) {
Uint8 *src = (Uint8 *)surface->pixels + y * surface->pitch; Uint8 *src = (Uint8 *) surface->pixels + y * surface->pitch;
SDL_RWwrite(dst, src, surface->pitch, 1); SDL_RWwrite(dst, src, surface->pitch, 1);
} }
SDL_FreeSurface(surface); SDL_FreeSurface(surface);
hicon = CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000); hicon =
CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000);
} }
SDL_RWclose(dst); SDL_RWclose(dst);
SDL_stack_free(icon_bmp); SDL_stack_free(icon_bmp);
} }
/* Set the icon for the window */ /* Set the icon for the window */
SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hicon); SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM) hicon);
/* Set the icon in the task manager (should we do this?) */ /* Set the icon in the task manager (should we do this?) */
SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hicon); SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM) hicon);
} }
void void
......
...@@ -659,22 +659,24 @@ X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) ...@@ -659,22 +659,24 @@ X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
Uint32 *propdata; Uint32 *propdata;
/* Convert the icon to ARGB for modern window managers */ /* Convert the icon to ARGB for modern window managers */
SDL_InitFormat(&format, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000); SDL_InitFormat(&format, 32, 0x00FF0000, 0x0000FF00, 0x000000FF,
0xFF000000);
surface = SDL_ConvertSurface(icon, &format, 0); surface = SDL_ConvertSurface(icon, &format, 0);
if (!surface) { if (!surface) {
return; return;
} }
/* Set the _NET_WM_ICON property */ /* Set the _NET_WM_ICON property */
propsize = 2+(icon->w*icon->h); propsize = 2 + (icon->w * icon->h);
propdata = SDL_malloc(propsize * sizeof(Uint32)); propdata = SDL_malloc(propsize * sizeof(Uint32));
if (propdata) { if (propdata) {
propdata[0] = icon->w; propdata[0] = icon->w;
propdata[1] = icon->h; propdata[1] = icon->h;
SDL_memcpy(&propdata[2], surface->pixels, surface->h*surface->pitch); SDL_memcpy(&propdata[2], surface->pixels,
XChangeProperty(display, data->window, _NET_WM_ICON, surface->h * surface->pitch);
XA_CARDINAL, 32, PropModeReplace, XChangeProperty(display, data->window, _NET_WM_ICON, XA_CARDINAL,
(unsigned char *) propdata, propsize); 32, PropModeReplace, (unsigned char *) propdata,
propsize);
} }
SDL_FreeSurface(surface); SDL_FreeSurface(surface);
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment