indent
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403502
This commit is contained in:
parent
072760ebb7
commit
628262d3af
13 changed files with 117 additions and 122 deletions
|
@ -228,9 +228,9 @@ extern DECLSPEC const SDL_VideoInfo *SDLCALL SDL_GetVideoInfo(void);
|
|||
extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width,
|
||||
int height,
|
||||
int bpp, Uint32 flags);
|
||||
extern DECLSPEC SDL_Rect **SDLCALL SDL_ListModes(const SDL_PixelFormat * format, Uint32 flags);
|
||||
extern DECLSPEC SDL_Surface *SDLCALL SDL_SetVideoMode(int width,
|
||||
int height,
|
||||
extern DECLSPEC SDL_Rect **SDLCALL SDL_ListModes(const SDL_PixelFormat *
|
||||
format, Uint32 flags);
|
||||
extern DECLSPEC SDL_Surface *SDLCALL SDL_SetVideoMode(int width, int height,
|
||||
int bpp, Uint32 flags);
|
||||
extern DECLSPEC SDL_Surface *SDLCALL SDL_GetVideoSurface(void);
|
||||
extern DECLSPEC void SDLCALL SDL_UpdateRects(SDL_Surface * screen,
|
||||
|
|
|
@ -915,7 +915,8 @@ SDL_BuildAudioResampleCVT(SDL_AudioCVT * cvt, int dst_channels,
|
|||
if (filter == NULL) {
|
||||
int i;
|
||||
const int upsample = (src_rate < dst_rate) ? 1 : 0;
|
||||
const int multiple = SDL_FindFrequencyMultiple(src_rate, dst_rate);
|
||||
const int multiple =
|
||||
SDL_FindFrequencyMultiple(src_rate, dst_rate);
|
||||
|
||||
for (i = 0; sdl_audio_rate_filters[i].filter != NULL; i++) {
|
||||
const SDL_AudioRateFilters *filt = &sdl_audio_rate_filters[i];
|
||||
|
@ -980,7 +981,6 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
|
|||
if ((src_rate == 0) || (dst_rate == 0)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CONVERT
|
||||
printf("Build format %04x->%04x, channels %u->%u, rate %d->%d\n",
|
||||
src_fmt, dst_fmt, src_channels, dst_channels, src_rate, dst_rate);
|
||||
|
@ -1054,7 +1054,8 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
|
|||
}
|
||||
|
||||
/* Do rate conversion, if necessary. Updates (cvt). */
|
||||
if (SDL_BuildAudioResampleCVT(cvt, dst_channels, src_rate, dst_rate) == -1) {
|
||||
if (SDL_BuildAudioResampleCVT(cvt, dst_channels, src_rate, dst_rate) ==
|
||||
-1) {
|
||||
return -1; /* shouldn't happen, but just in case... */
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,8 @@ CalculateGammaRamp(float gamma, Uint16 * ramp)
|
|||
int value;
|
||||
gamma = 1.0f / gamma;
|
||||
for (i = 0; i < 256; ++i) {
|
||||
value = (int) (SDL_pow((double) i / 256.0, gamma) * 65535.0 + 0.5);
|
||||
value =
|
||||
(int) (SDL_pow((double) i / 256.0, gamma) * 65535.0 + 0.5);
|
||||
if (value > 65535) {
|
||||
value = 65535;
|
||||
}
|
||||
|
|
|
@ -199,8 +199,7 @@ DirectFB_WM_MaximizeWindow(_THIS, SDL_Window * window)
|
|||
SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
|
||||
|
||||
windata->window->GetPosition(windata->window,
|
||||
&windata->restore.x,
|
||||
&windata->restore.y);
|
||||
&windata->restore.x, &windata->restore.y);
|
||||
windata->window->GetSize(windata->window, &windata->restore.w,
|
||||
&windata->restore.h);
|
||||
|
||||
|
@ -210,8 +209,7 @@ DirectFB_WM_MaximizeWindow(_THIS, SDL_Window * window)
|
|||
|
||||
windata->window->MoveTo(windata->window, 0, 0);
|
||||
windata->window->Resize(windata->window,
|
||||
display->current_mode.w,
|
||||
display->current_mode.h);
|
||||
display->current_mode.w, display->current_mode.h);
|
||||
SDL_SendWindowEvent(windata->sdl_id, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -306,7 +304,8 @@ DirectFB_WM_ProcessEvent(_THIS, SDL_Window *window, DFBWindowEvent * evt)
|
|||
case WM_POS_NONE:
|
||||
return 0;
|
||||
case WM_POS_CLOSE:
|
||||
SDL_SendWindowEvent(windata->sdl_id, SDL_WINDOWEVENT_CLOSE, 0, 0);
|
||||
SDL_SendWindowEvent(windata->sdl_id, SDL_WINDOWEVENT_CLOSE, 0,
|
||||
0);
|
||||
return 1;
|
||||
case WM_POS_MAX:
|
||||
if (window->flags & SDL_WINDOW_MAXIMIZED) {
|
||||
|
|
|
@ -46,9 +46,11 @@ extern void DirectFB_WM_MaximizeWindow(_THIS, SDL_Window * window);
|
|||
extern void DirectFB_WM_RestoreWindow(_THIS, SDL_Window * window);
|
||||
extern void DirectFB_WM_RedrawLayout(SDL_Window * window);
|
||||
|
||||
extern int DirectFB_WM_ProcessEvent(_THIS, SDL_Window *window, DFBWindowEvent * evt);
|
||||
extern int DirectFB_WM_ProcessEvent(_THIS, SDL_Window * window,
|
||||
DFBWindowEvent * evt);
|
||||
|
||||
extern DFBResult DirectFB_WM_GetClientSize(_THIS, SDL_Window * window, int *cw, int *ch);
|
||||
extern DFBResult DirectFB_WM_GetClientSize(_THIS, SDL_Window * window,
|
||||
int *cw, int *ch);
|
||||
|
||||
|
||||
#endif /* _SDL_directfb_wm_h */
|
||||
|
|
|
@ -193,7 +193,8 @@ ProcessWindowEvent(_THIS, DFB_WindowData * p, Uint32 flags,
|
|||
}
|
||||
}
|
||||
if (!(window->flags & SDL_WINDOW_MOUSE_FOCUS))
|
||||
SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_ENTER, 0, 0);
|
||||
SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_ENTER, 0,
|
||||
0);
|
||||
}
|
||||
break;
|
||||
case DWET_KEYDOWN:
|
||||
|
|
|
@ -198,15 +198,13 @@ SetBlendMode(DirectFB_RenderData * data, int blendMode,
|
|||
data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
|
||||
data->drawFlags = DSDRAW_BLEND;
|
||||
destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA);
|
||||
destsurf->SetDstBlendFunction(destsurf,
|
||||
DSBF_INVSRCALPHA);
|
||||
destsurf->SetDstBlendFunction(destsurf, DSBF_INVSRCALPHA);
|
||||
break;
|
||||
case SDL_BLENDMODE_BLEND:
|
||||
data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
|
||||
data->drawFlags = DSDRAW_BLEND;
|
||||
destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA);
|
||||
destsurf->SetDstBlendFunction(destsurf,
|
||||
DSBF_INVSRCALPHA);
|
||||
destsurf->SetDstBlendFunction(destsurf, DSBF_INVSRCALPHA);
|
||||
break;
|
||||
case SDL_BLENDMODE_ADD:
|
||||
data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
|
||||
|
@ -215,8 +213,7 @@ SetBlendMode(DirectFB_RenderData * data, int blendMode,
|
|||
// It will be cheaper to copy the surface to
|
||||
// a temporay surface and premultiply
|
||||
if (source && TextureHasAlpha(source))
|
||||
destsurf->SetSrcBlendFunction(destsurf,
|
||||
DSBF_SRCALPHA);
|
||||
destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA);
|
||||
else
|
||||
destsurf->SetSrcBlendFunction(destsurf, DSBF_ONE);
|
||||
destsurf->SetDstBlendFunction(destsurf, DSBF_ONE);
|
||||
|
@ -324,7 +321,8 @@ DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags)
|
|||
} else
|
||||
data->flipflags |= DSFLIP_ONSYNC;
|
||||
|
||||
SDL_DFB_CHECKERR(windata->surface->GetCapabilities(windata->surface, &scaps));
|
||||
SDL_DFB_CHECKERR(windata->surface->
|
||||
GetCapabilities(windata->surface, &scaps));
|
||||
if (scaps & DSCAPS_DOUBLE)
|
||||
renderer->info.flags |= SDL_RENDERER_PRESENTFLIP2;
|
||||
else if (scaps & DSCAPS_TRIPLE)
|
||||
|
@ -809,8 +807,7 @@ PrepareDraw(SDL_Renderer * renderer)
|
|||
a = renderer->a;
|
||||
|
||||
SetBlendMode(data, renderer->blendMode, NULL);
|
||||
SDL_DFB_CHECKERR(destsurf->SetDrawingFlags(destsurf,
|
||||
data->drawFlags));
|
||||
SDL_DFB_CHECKERR(destsurf->SetDrawingFlags(destsurf, data->drawFlags));
|
||||
|
||||
switch (renderer->blendMode) {
|
||||
case SDL_BLENDMODE_NONE:
|
||||
|
@ -856,8 +853,7 @@ DirectFB_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2)
|
|||
PrepareDraw(renderer);
|
||||
/* Use antialiasing when available */
|
||||
#if (DFB_VERSION_ATLEAST(1,2,0))
|
||||
SDL_DFB_CHECKERR(destsurf->SetRenderOptions(destsurf,
|
||||
DSRO_ANTIALIAS));
|
||||
SDL_DFB_CHECKERR(destsurf->SetRenderOptions(destsurf, DSRO_ANTIALIAS));
|
||||
#endif
|
||||
SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, x1, y1, x2, y2));
|
||||
return 0;
|
||||
|
@ -938,9 +934,11 @@ DirectFB_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
SDLtoDFBRect(srcrect, &sr);
|
||||
SDLtoDFBRect(dstrect, &dr);
|
||||
|
||||
SDL_DFB_CHECKERR(destsurf->SetColor(destsurf, 0xFF, 0xFF, 0xFF, 0xFF));
|
||||
if (texture->modMode &
|
||||
(SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA)) {
|
||||
SDL_DFB_CHECKERR(destsurf->
|
||||
SetColor(destsurf, 0xFF, 0xFF, 0xFF, 0xFF));
|
||||
if (texture->
|
||||
modMode & (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA))
|
||||
{
|
||||
if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA) {
|
||||
alpha = texture->a;
|
||||
SDL_DFB_CHECKERR(destsurf->SetColor(destsurf, 0xFF, 0xFF,
|
||||
|
@ -963,8 +961,7 @@ DirectFB_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
SetBlendMode(data, texture->blendMode, texturedata);
|
||||
|
||||
SDL_DFB_CHECKERR(destsurf->SetBlittingFlags(destsurf,
|
||||
data->blitFlags
|
||||
| flags));
|
||||
data->blitFlags | flags));
|
||||
|
||||
#if (DFB_VERSION_ATLEAST(1,2,0))
|
||||
SDL_DFB_CHECKERR(destsurf->SetRenderOptions(destsurf,
|
||||
|
|
|
@ -101,7 +101,8 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window)
|
|||
windata->window->SetOptions(windata->window, wopts);
|
||||
|
||||
/* See what we got */
|
||||
SDL_DFB_CHECKERR(DirectFB_WM_GetClientSize(_this, window, &window->w, &window->h));
|
||||
SDL_DFB_CHECKERR(DirectFB_WM_GetClientSize
|
||||
(_this, window, &window->w, &window->h));
|
||||
|
||||
/* Get the window's surface. */
|
||||
SDL_DFB_CHECKERR(windata->window->GetSurface(windata->window,
|
||||
|
@ -115,9 +116,10 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window)
|
|||
|
||||
/* Create Eventbuffer */
|
||||
SDL_DFB_CHECKERR(windata->window->CreateEventBuffer(windata->window,
|
||||
&windata->eventbuffer));
|
||||
SDL_DFB_CHECKERR(windata->
|
||||
window->EnableEvents(windata->window, DWET_ALL));
|
||||
&windata->
|
||||
eventbuffer));
|
||||
SDL_DFB_CHECKERR(windata->window->
|
||||
EnableEvents(windata->window, DWET_ALL));
|
||||
|
||||
/* Create a font */
|
||||
/* FIXME: once during Video_Init */
|
||||
|
@ -279,7 +281,8 @@ DirectFB_SetWindowSize(_THIS, SDL_Window * window)
|
|||
SDL_DFB_CHECKERR(windata->window->EnableEvents(windata->window,
|
||||
DWET_ALL));
|
||||
|
||||
SDL_DFB_CHECKERR(DirectFB_WM_GetClientSize(_this, window, &window->w, &window->h));
|
||||
SDL_DFB_CHECKERR(DirectFB_WM_GetClientSize
|
||||
(_this, window, &window->w, &window->h));
|
||||
|
||||
SDL_OnWindowResized(window);
|
||||
}
|
||||
|
@ -440,12 +443,11 @@ DirectFB_AdjustWindowSurface(SDL_Window * window)
|
|||
windata->size.w,
|
||||
windata->size.h));
|
||||
SDL_DFB_CHECKERR(windata->window_surface->
|
||||
GetSubSurface(windata->window_surface, &windata->client,
|
||||
&windata->surface));
|
||||
GetSubSurface(windata->window_surface,
|
||||
&windata->client, &windata->surface));
|
||||
#endif
|
||||
DirectFB_WM_RedrawLayout(window);
|
||||
}
|
||||
error:
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -310,7 +310,6 @@ X11_DispatchEvent(_THIS)
|
|||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
#if SDL_VIDEO_DRIVER_X11_XINPUT
|
||||
data = (X11_MouseData *) mouse->driverdata;
|
||||
if (xevent.type == data->motion) {
|
||||
|
@ -415,7 +414,8 @@ X11_PumpEvents(_THIS)
|
|||
#ifdef GNOME_SCREENSAVER_HACK
|
||||
#include <unistd.h>
|
||||
static pid_t screensaver_inhibit_pid;
|
||||
static void gnome_screensaver_disable()
|
||||
static void
|
||||
gnome_screensaver_disable()
|
||||
{
|
||||
screensaver_inhibit_pid = fork();
|
||||
if (screensaver_inhibit_pid == 0) {
|
||||
|
@ -426,12 +426,12 @@ static void gnome_screensaver_disable()
|
|||
"gnome-screensaver-command",
|
||||
"--inhibit",
|
||||
"--reason",
|
||||
"GNOME screensaver doesn't respect MIT-SCREEN-SAVER",
|
||||
NULL);
|
||||
"GNOME screensaver doesn't respect MIT-SCREEN-SAVER", NULL);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
static void gnome_screensaver_enable()
|
||||
static void
|
||||
gnome_screensaver_enable()
|
||||
{
|
||||
kill(screensaver_inhibit_pid, 15);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include <stdio.h>
|
||||
#include "SDL.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
SDL_AudioSpec spec;
|
||||
SDL_AudioCVT cvt;
|
||||
|
@ -13,30 +14,26 @@ int main(int argc, char **argv)
|
|||
int avgbytes = 0;
|
||||
SDL_RWops *io = NULL;
|
||||
|
||||
if (argc != 4)
|
||||
{
|
||||
if (argc != 4) {
|
||||
fprintf(stderr, "USAGE: %s in.wav out.wav newfreq\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
cvtfreq = atoi(argv[3]);
|
||||
|
||||
if (SDL_Init(SDL_INIT_AUDIO) == -1)
|
||||
{
|
||||
if (SDL_Init(SDL_INIT_AUDIO) == -1) {
|
||||
fprintf(stderr, "SDL_Init() failed: %s\n", SDL_GetError());
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (SDL_LoadWAV(argv[1], &spec, &data, &len) == NULL)
|
||||
{
|
||||
if (SDL_LoadWAV(argv[1], &spec, &data, &len) == NULL) {
|
||||
fprintf(stderr, "failed to load %s: %s\n", argv[1], SDL_GetError());
|
||||
SDL_Quit();
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (SDL_BuildAudioCVT(&cvt, spec.format, spec.channels, spec.freq,
|
||||
spec.format, spec.channels, cvtfreq) == -1)
|
||||
{
|
||||
spec.format, spec.channels, cvtfreq) == -1) {
|
||||
fprintf(stderr, "failed to build CVT: %s\n", SDL_GetError());
|
||||
SDL_FreeWAV(data);
|
||||
SDL_Quit();
|
||||
|
@ -45,8 +42,7 @@ int main(int argc, char **argv)
|
|||
|
||||
cvt.len = len;
|
||||
cvt.buf = (Uint8 *) malloc(len * cvt.len_mult);
|
||||
if (cvt.buf == NULL)
|
||||
{
|
||||
if (cvt.buf == NULL) {
|
||||
fprintf(stderr, "Out of memory.\n");
|
||||
SDL_FreeWAV(data);
|
||||
SDL_Quit();
|
||||
|
@ -54,8 +50,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
memcpy(cvt.buf, data, len);
|
||||
|
||||
if (SDL_ConvertAudio(&cvt) == -1)
|
||||
{
|
||||
if (SDL_ConvertAudio(&cvt) == -1) {
|
||||
fprintf(stderr, "Conversion failed: %s\n", SDL_GetError());
|
||||
free(cvt.buf);
|
||||
SDL_FreeWAV(data);
|
||||
|
@ -65,8 +60,7 @@ int main(int argc, char **argv)
|
|||
|
||||
/* write out a WAV header... */
|
||||
io = SDL_RWFromFile(argv[2], "wb");
|
||||
if (io == NULL)
|
||||
{
|
||||
if (io == NULL) {
|
||||
fprintf(stderr, "fopen('%s') failed: %s\n", argv[2], SDL_GetError());
|
||||
free(cvt.buf);
|
||||
SDL_FreeWAV(data);
|
||||
|
@ -93,8 +87,7 @@ int main(int argc, char **argv)
|
|||
SDL_WriteLE32(io, cvt.len_cvt); /* size */
|
||||
SDL_RWwrite(io, cvt.buf, cvt.len_cvt, 1);
|
||||
|
||||
if (SDL_RWclose(io) == -1)
|
||||
{
|
||||
if (SDL_RWclose(io) == -1) {
|
||||
fprintf(stderr, "fclose('%s') failed: %s\n", argv[2], SDL_GetError());
|
||||
free(cvt.buf);
|
||||
SDL_FreeWAV(data);
|
||||
|
@ -109,4 +102,3 @@ int main(int argc, char **argv)
|
|||
} // main
|
||||
|
||||
// end of resample_test.c ...
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue