diff --git a/src/SDL_compat.c b/src/SDL_compat.c index 80e74d36..901c15ac 100644 --- a/src/SDL_compat.c +++ b/src/SDL_compat.c @@ -1350,7 +1350,7 @@ struct private_yuvhwdata Uint16 pitches[3]; Uint8 *planes[3]; - SDL_SW_YUVTexture *sw; + SDL_SW_YUVTexture *sw; SDL_TextureID textureID; }; @@ -1435,19 +1435,20 @@ SDL_CreateYUVOverlay(int w, int h, Uint32 format, SDL_Surface * display) overlay->hwdata->textureID = SDL_CreateTexture(texture_format, SDL_TEXTUREACCESS_STREAMING, w, h); if (overlay->hwdata->textureID) { - overlay->hwdata->sw = NULL; - } else { - overlay->hwdata->sw = SDL_SW_CreateYUVTexture(texture_format, w, h); - if (!overlay->hwdata->sw) { - SDL_FreeYUVOverlay(overlay); - return NULL; - } + overlay->hwdata->sw = NULL; + } else { + overlay->hwdata->sw = SDL_SW_CreateYUVTexture(texture_format, w, h); + if (!overlay->hwdata->sw) { + SDL_FreeYUVOverlay(overlay); + return NULL; + } - /* Create a supported RGB format texture for display */ - overlay->hwdata->textureID = - SDL_CreateTexture(SDL_PIXELFORMAT_RGB888, SDL_TEXTUREACCESS_STREAMING, w, h); - } - if (!overlay->hwdata->textureID) { + /* Create a supported RGB format texture for display */ + overlay->hwdata->textureID = + SDL_CreateTexture(SDL_PIXELFORMAT_RGB888, + SDL_TEXTUREACCESS_STREAMING, w, h); + } + if (!overlay->hwdata->textureID) { SDL_FreeYUVOverlay(overlay); return NULL; } @@ -1465,16 +1466,18 @@ SDL_LockYUVOverlay(SDL_Overlay * overlay) SDL_SetError("Passed a NULL overlay"); return -1; } - if (overlay->hwdata->sw) { - if (SDL_SW_QueryYUVTexturePixels(overlay->hwdata->sw, &pixels, &pitch) < 0) { - return -1; - } - } else { - if (SDL_LockTexture(overlay->hwdata->textureID, NULL, 1, &pixels, &pitch) - < 0) { - return -1; - } - } + if (overlay->hwdata->sw) { + if (SDL_SW_QueryYUVTexturePixels(overlay->hwdata->sw, &pixels, &pitch) + < 0) { + return -1; + } + } else { + if (SDL_LockTexture + (overlay->hwdata->textureID, NULL, 1, &pixels, &pitch) + < 0) { + return -1; + } + } overlay->pixels[0] = (Uint8 *) pixels; overlay->pitches[0] = pitch; switch (overlay->format) { @@ -1501,22 +1504,25 @@ SDL_UnlockYUVOverlay(SDL_Overlay * overlay) if (!overlay) { return; } - if (overlay->hwdata->sw) { - void *pixels; - int pitch; - if (SDL_LockTexture(overlay->hwdata->textureID, NULL, 1, &pixels, &pitch) == 0) { - SDL_Rect srcrect; + if (overlay->hwdata->sw) { + void *pixels; + int pitch; + if (SDL_LockTexture + (overlay->hwdata->textureID, NULL, 1, &pixels, &pitch) == 0) { + SDL_Rect srcrect; - srcrect.x = 0; - srcrect.y = 0; - srcrect.w = overlay->w; - srcrect.h = overlay->h; - SDL_SW_CopyYUVToRGB(overlay->hwdata->sw, &srcrect, SDL_PIXELFORMAT_RGB888, overlay->w, overlay->h, pixels, pitch); - SDL_UnlockTexture(overlay->hwdata->textureID); - } - } else { - SDL_UnlockTexture(overlay->hwdata->textureID); - } + srcrect.x = 0; + srcrect.y = 0; + srcrect.w = overlay->w; + srcrect.h = overlay->h; + SDL_SW_CopyYUVToRGB(overlay->hwdata->sw, &srcrect, + SDL_PIXELFORMAT_RGB888, overlay->w, + overlay->h, pixels, pitch); + SDL_UnlockTexture(overlay->hwdata->textureID); + } + } else { + SDL_UnlockTexture(overlay->hwdata->textureID); + } } int diff --git a/src/haptic/win32/SDL_syshaptic.c b/src/haptic/win32/SDL_syshaptic.c index e7f5fba2..e8b1a95f 100644 --- a/src/haptic/win32/SDL_syshaptic.c +++ b/src/haptic/win32/SDL_syshaptic.c @@ -105,11 +105,11 @@ static BOOL CALLBACK DI_EffectCallback(LPCDIEFFECTINFO pei, LPVOID pv); static void DI_SetError(const char *str, HRESULT err) { - /* - SDL_SetError("Haptic: %s - %s: %s", str, - DXGetErrorString8A(err), DXGetErrorDescription8A(err)); - */ - SDL_SetError("Haptic error %s", str); + /* + SDL_SetError("Haptic: %s - %s: %s", str, + DXGetErrorString8A(err), DXGetErrorDescription8A(err)); + */ + SDL_SetError("Haptic error %s", str); } @@ -154,7 +154,7 @@ SDL_SYS_HapticInit(void) } ret = CoCreateInstance(&CLSID_DirectInput, NULL, CLSCTX_INPROC_SERVER, - &IID_IDirectInput, (LPVOID)&dinput); + &IID_IDirectInput, (LPVOID) & dinput); if (FAILED(ret)) { DI_SetError("CoCreateInstance", ret); return -1; diff --git a/src/video/SDL_renderer_sw.c b/src/video/SDL_renderer_sw.c index 679d75ce..c2d0220b 100644 --- a/src/video/SDL_renderer_sw.c +++ b/src/video/SDL_renderer_sw.c @@ -361,7 +361,8 @@ static int SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) { if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { - texture->driverdata = SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h); + texture->driverdata = + SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h); } else { int bpp; Uint32 Rmask, Gmask, Bmask, Amask; diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index 23830293..7b461f3a 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -271,68 +271,68 @@ SDL_SetColorKey(SDL_Surface * surface, Uint32 flag, Uint32 key) /* This is a fairly slow function to switch from colorkey to alpha */ void -SDL_ConvertColorkeyToAlpha(SDL_Surface *surface) +SDL_ConvertColorkeyToAlpha(SDL_Surface * surface) { - int x, y; + int x, y; - if (!surface) { - return; - } + if (!surface) { + return; + } - if (!(surface->map->info.flags & SDL_COPY_COLORKEY) || - !surface->format->Amask) { - return; - } + if (!(surface->map->info.flags & SDL_COPY_COLORKEY) || + !surface->format->Amask) { + return; + } - SDL_LockSurface(surface); + SDL_LockSurface(surface); - switch (surface->format->BytesPerPixel) { - case 2: - { - Uint16 *row, *spot; - Uint16 ckey = (Uint16)surface->map->info.colorkey; - Uint16 mask = (Uint16)(~surface->format->Amask); + switch (surface->format->BytesPerPixel) { + case 2: + { + Uint16 *row, *spot; + Uint16 ckey = (Uint16) surface->map->info.colorkey; + Uint16 mask = (Uint16) (~surface->format->Amask); - row = (Uint16 *)surface->pixels; - for (y = surface->h; y--; ) { - spot = row; - for (x = surface->w; x--; ) { - if (*spot == ckey) { - *spot &= mask; - } - ++spot; - } - row += surface->pitch / 2; - } - } - break; - case 3: - /* FIXME */ - break; - case 4: - { - Uint32 *row, *spot; - Uint32 ckey = surface->map->info.colorkey; - Uint32 mask = ~surface->format->Amask; + row = (Uint16 *) surface->pixels; + for (y = surface->h; y--;) { + spot = row; + for (x = surface->w; x--;) { + if (*spot == ckey) { + *spot &= mask; + } + ++spot; + } + row += surface->pitch / 2; + } + } + break; + case 3: + /* FIXME */ + break; + case 4: + { + Uint32 *row, *spot; + Uint32 ckey = surface->map->info.colorkey; + Uint32 mask = ~surface->format->Amask; - row = (Uint32 *)surface->pixels; - for (y = surface->h; y--; ) { - spot = row; - for (x = surface->w; x--; ) { - if (*spot == ckey) { - *spot &= mask; - } - ++spot; - } - row += surface->pitch / 4; - } - } - break; - } + row = (Uint32 *) surface->pixels; + for (y = surface->h; y--;) { + spot = row; + for (x = surface->w; x--;) { + if (*spot == ckey) { + *spot &= mask; + } + ++spot; + } + row += surface->pitch / 4; + } + } + break; + } - SDL_UnlockSurface(surface); + SDL_UnlockSurface(surface); - SDL_SetColorKey(surface, 0, 0); + SDL_SetColorKey(surface, 0, 0); } int diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index b9bca0c0..e59cc84c 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -47,7 +47,7 @@ #endif /* SDL_VIDEO_OPENGL */ /* From SDL_surface.c */ -extern void SDL_ConvertColorkeyToAlpha(SDL_Surface *surface); +extern void SDL_ConvertColorkeyToAlpha(SDL_Surface * surface); /* Available video drivers */ static VideoBootStrap *bootstrap[] = { @@ -1588,7 +1588,7 @@ SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface * surface) } dst = SDL_ConvertSurface(surface, dst_fmt, 0); if (dst) { - SDL_ConvertColorkeyToAlpha(dst); + SDL_ConvertColorkeyToAlpha(dst); SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch); SDL_FreeSurface(dst); } diff --git a/src/video/SDL_yuv_sw.c b/src/video/SDL_yuv_sw.c index 03545881..85857fdd 100644 --- a/src/video/SDL_yuv_sw.c +++ b/src/video/SDL_yuv_sw.c @@ -91,9 +91,9 @@ struct SDL_SW_YUVTexture { - Uint32 format; + Uint32 format; Uint32 target_format; - int w, h; + int w, h; Uint8 *pixels; int *colortab; Uint32 *rgb_2_pix; @@ -1075,8 +1075,8 @@ SDL_SW_CreateYUVTexture(Uint32 format, int w, int h) swdata->format = format; swdata->target_format = SDL_PIXELFORMAT_UNKNOWN; - swdata->w = w; - swdata->h = h; + swdata->w = w; + swdata->h = h; swdata->pixels = (Uint8 *) SDL_malloc(w * h * 2); swdata->colortab = (int *) SDL_malloc(4 * 256 * sizeof(int)); swdata->rgb_2_pix = (Uint32 *) SDL_malloc(3 * 768 * sizeof(Uint32)); @@ -1110,10 +1110,8 @@ SDL_SW_CreateYUVTexture(Uint32 format, int w, int h) swdata->pitches[1] = swdata->pitches[0] / 2; swdata->pitches[2] = swdata->pitches[0] / 2; swdata->planes[0] = swdata->pixels; - swdata->planes[1] = - swdata->planes[0] + swdata->pitches[0] * h; - swdata->planes[2] = - swdata->planes[1] + swdata->pitches[1] * h / 2; + swdata->planes[1] = swdata->planes[0] + swdata->pitches[0] * h; + swdata->planes[2] = swdata->planes[1] + swdata->pitches[1] * h / 2; break; case SDL_PIXELFORMAT_YUY2: case SDL_PIXELFORMAT_UYVY: diff --git a/src/video/win32/SDL_d3drender.c b/src/video/win32/SDL_d3drender.c index 06e07d6b..7b7dd96d 100644 --- a/src/video/win32/SDL_d3drender.c +++ b/src/video/win32/SDL_d3drender.c @@ -27,7 +27,7 @@ /* Direct3D renderer implementation */ -#if 1 /* This takes more memory but you won't lose your texture data */ +#if 1 /* This takes more memory but you won't lose your texture data */ #define D3DPOOL_SDL D3DPOOL_MANAGED #define SDL_MEMORY_POOL_MANAGED #else @@ -633,7 +633,8 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, d3drect.top = rect->y; d3drect.bottom = rect->y + rect->h; - result = IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0); + result = + IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0); if (FAILED(result)) { D3D_SetError("LockRect()", result); return -1; diff --git a/src/video/win32/SDL_gdirender.c b/src/video/win32/SDL_gdirender.c index 31d07dba..027dd29c 100644 --- a/src/video/win32/SDL_gdirender.c +++ b/src/video/win32/SDL_gdirender.c @@ -294,7 +294,8 @@ GDI_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) texture->driverdata = data; if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { - data->yuv = SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h); + data->yuv = + SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h); if (!data->yuv) { return -1; } diff --git a/test/testsprite.c b/test/testsprite.c index 5f541a14..b1303845 100644 --- a/test/testsprite.c +++ b/test/testsprite.c @@ -311,7 +311,7 @@ main(int argc, char *argv[]) /* Print out some timing information */ now = SDL_GetTicks(); if (now > then) { - double fps = ((double) frames * 1000) / (now - then); + double fps = ((double) frames * 1000) / (now - then); printf("%2.2f frames per second\n", fps); } SDL_Quit(); diff --git a/test/testsprite2.c b/test/testsprite2.c index ac2e1646..cb3b48bc 100644 --- a/test/testsprite2.c +++ b/test/testsprite2.c @@ -291,7 +291,7 @@ main(int argc, char *argv[]) /* Print out some timing information */ now = SDL_GetTicks(); if (now > then) { - double fps = ((double) frames * 1000) / (now - then); + double fps = ((double) frames * 1000) / (now - then); printf("%2.2f frames per second\n", fps); } quit(0);