Commit a90680c7 authored by Sam Lantinga's avatar Sam Lantinga

In general, fill in pointers to structures, rather than return them.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402014
parent ade506e8
...@@ -237,7 +237,8 @@ extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture); ...@@ -237,7 +237,8 @@ extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture);
* Must be a value between 0 and (number of audio devices-1). * Must be a value between 0 and (number of audio devices-1).
* Only valid after a successfully initializing the audio subsystem. * Only valid after a successfully initializing the audio subsystem.
*/ */
extern DECLSPEC const char *SDLCALL SDL_GetAudioDevice(int index, int iscapture); extern DECLSPEC const char *SDLCALL SDL_GetAudioDevice(int index,
int iscapture);
/* /*
...@@ -245,11 +246,14 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDevice(int index, int iscapture) ...@@ -245,11 +246,14 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDevice(int index, int iscapture)
* equivalent to SDL_OpenAudio(). Returns 0 on error, a valid device ID * equivalent to SDL_OpenAudio(). Returns 0 on error, a valid device ID
* on success. * on success.
*/ */
extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice( extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char
const char * device, *device,
int iscapture, int iscapture,
const SDL_AudioSpec * desired, const
SDL_AudioSpec * obtained); SDL_AudioSpec *
desired,
SDL_AudioSpec *
obtained);
...@@ -264,8 +268,8 @@ typedef enum ...@@ -264,8 +268,8 @@ typedef enum
} SDL_audiostatus; } SDL_audiostatus;
extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioStatus(void); extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioStatus(void);
extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioDeviceStatus( extern DECLSPEC SDL_audiostatus SDLCALL
SDL_AudioDeviceID dev); SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev);
/* /*
* This function pauses and unpauses the audio callback processing. * This function pauses and unpauses the audio callback processing.
...@@ -352,7 +356,8 @@ extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src, ...@@ -352,7 +356,8 @@ extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src,
* using the format of audio device 1. Thus it can be used when no audio * using the format of audio device 1. Thus it can be used when no audio
* device is open at all. * device is open at all.
*/ */
extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
const Uint8 * src,
SDL_AudioFormat format, SDL_AudioFormat format,
Uint32 len, int volume); Uint32 len, int volume);
......
...@@ -432,7 +432,7 @@ extern DECLSPEC int SDLCALL SDL_GetCurrentVideoDisplay(void); ...@@ -432,7 +432,7 @@ extern DECLSPEC int SDLCALL SDL_GetCurrentVideoDisplay(void);
extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(void); extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(void);
/** /**
* \fn const SDL_DisplayMode *SDL_GetDisplayMode(int index) * \fn int SDL_GetDisplayMode(int index, SDL_DisplayMode *mode)
* *
* \brief Retrieve information about a specific display mode. * \brief Retrieve information about a specific display mode.
* *
...@@ -444,23 +444,22 @@ extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(void); ...@@ -444,23 +444,22 @@ extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(void);
* *
* \sa SDL_GetNumDisplayModes() * \sa SDL_GetNumDisplayModes()
*/ */
extern DECLSPEC const SDL_DisplayMode *SDLCALL SDL_GetDisplayMode(int index); extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int index,
SDL_DisplayMode * mode);
/** /**
* \fn const SDL_DisplayMode *SDL_GetDesktopDisplayMode(void) * \fn int SDL_GetDesktopDisplayMode(SDL_DisplayMode *mode)
* *
* \brief Retrieve information about the desktop display mode for the current display. * \brief Retrieve information about the desktop display mode for the current display.
*/ */
extern DECLSPEC const SDL_DisplayMode *SDLCALL extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(SDL_DisplayMode * mode);
SDL_GetDesktopDisplayMode(void);
/** /**
* \fn const SDL_DisplayMode *SDL_GetCurrentDisplayMode(void) * \fn int SDL_GetCurrentDisplayMode(SDL_DisplayMode *mode)
* *
* \brief Retrieve information about the current display mode. * \brief Retrieve information about the current display mode.
*/ */
extern DECLSPEC const SDL_DisplayMode *SDLCALL extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(SDL_DisplayMode * mode);
SDL_GetCurrentDisplayMode(void);
/** /**
* \fn SDL_DisplayMode *SDL_GetClosestDisplayMode(const SDL_DisplayMode *mode, SDL_DisplayMode *closest) * \fn SDL_DisplayMode *SDL_GetClosestDisplayMode(const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
...@@ -499,13 +498,13 @@ extern DECLSPEC int SDLCALL SDL_SetFullscreenDisplayMode(const SDL_DisplayMode ...@@ -499,13 +498,13 @@ extern DECLSPEC int SDLCALL SDL_SetFullscreenDisplayMode(const SDL_DisplayMode
* mode); * mode);
/** /**
* \fn const SDL_DisplayMode *SDL_GetFullscreenDisplayMode(void) * \fn int SDL_GetFullscreenDisplayMode(SDL_DisplayMode *mode)
* *
* \brief Query the display mode used when a fullscreen window is visible * \brief Query the display mode used when a fullscreen window is visible
* on the currently selected display. * on the currently selected display.
*/ */
extern DECLSPEC const SDL_DisplayMode *SDLCALL extern DECLSPEC int SDLCALL SDL_GetFullscreenDisplayMode(SDL_DisplayMode *
SDL_GetFullscreenDisplayMode(void); mode);
/** /**
* \fn int SDL_SetDisplayPalette(const SDL_Color *colors, int firstcolor, int ncolors) * \fn int SDL_SetDisplayPalette(const SDL_Color *colors, int firstcolor, int ncolors)
......
...@@ -65,14 +65,15 @@ const SDL_VideoInfo * ...@@ -65,14 +65,15 @@ const SDL_VideoInfo *
SDL_GetVideoInfo(void) SDL_GetVideoInfo(void)
{ {
static SDL_VideoInfo info; static SDL_VideoInfo info;
SDL_DisplayMode mode;
/* Memory leak, compatibility code, who cares? */ /* Memory leak, compatibility code, who cares? */
if (!info.vfmt && SDL_GetDesktopDisplayMode()) { if (!info.vfmt && SDL_GetDesktopDisplayMode(&mode) == 0) {
int bpp; int bpp;
Uint32 Rmask, Gmask, Bmask, Amask; Uint32 Rmask, Gmask, Bmask, Amask;
SDL_PixelFormatEnumToMasks(SDL_GetDesktopDisplayMode()->format, &bpp, SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, &Bmask,
&Rmask, &Gmask, &Bmask, &Amask); &Amask);
info.vfmt = SDL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask); info.vfmt = SDL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask);
} }
return &info; return &info;
...@@ -88,17 +89,20 @@ SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags) ...@@ -88,17 +89,20 @@ SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags)
} }
if (!(flags & SDL_FULLSCREEN)) { if (!(flags & SDL_FULLSCREEN)) {
return SDL_BITSPERPIXEL(SDL_GetDesktopDisplayMode()->format); SDL_DisplayMode mode;
SDL_GetDesktopDisplayMode(&mode);
return SDL_BITSPERPIXEL(mode.format);
} }
for (i = 0; i < SDL_GetNumDisplayModes(); ++i) { for (i = 0; i < SDL_GetNumDisplayModes(); ++i) {
const SDL_DisplayMode *mode = SDL_GetDisplayMode(i); SDL_DisplayMode mode;
if (!mode->w || !mode->h || (width == mode->w && height == mode->h)) { SDL_GetDisplayMode(i, &mode);
if (!mode->format) { if (!mode.w || !mode.h || (width == mode.w && height == mode.h)) {
if (!mode.format) {
return bpp; return bpp;
} }
if (SDL_BITSPERPIXEL(mode->format) >= (Uint32) bpp) { if (SDL_BITSPERPIXEL(mode.format) >= (Uint32) bpp) {
actual_bpp = SDL_BITSPERPIXEL(mode->format); actual_bpp = SDL_BITSPERPIXEL(mode.format);
} }
} }
} }
...@@ -123,15 +127,16 @@ SDL_ListModes(SDL_PixelFormat * format, Uint32 flags) ...@@ -123,15 +127,16 @@ SDL_ListModes(SDL_PixelFormat * format, Uint32 flags)
nmodes = 0; nmodes = 0;
modes = NULL; modes = NULL;
for (i = 0; i < SDL_GetNumDisplayModes(); ++i) { for (i = 0; i < SDL_GetNumDisplayModes(); ++i) {
const SDL_DisplayMode *mode = SDL_GetDisplayMode(i); SDL_DisplayMode mode;
if (!mode->w || !mode->h) { SDL_GetDisplayMode(i, &mode);
if (!mode.w || !mode.h) {
return (SDL_Rect **) (-1); return (SDL_Rect **) (-1);
} }
if (SDL_BITSPERPIXEL(mode->format) != format->BitsPerPixel) { if (SDL_BITSPERPIXEL(mode.format) != format->BitsPerPixel) {
continue; continue;
} }
if (nmodes > 0 && modes[nmodes - 1]->w == mode->w if (nmodes > 0 && modes[nmodes - 1]->w == mode.w
&& modes[nmodes - 1]->h == mode->h) { && modes[nmodes - 1]->h == mode.h) {
continue; continue;
} }
...@@ -145,8 +150,8 @@ SDL_ListModes(SDL_PixelFormat * format, Uint32 flags) ...@@ -145,8 +150,8 @@ SDL_ListModes(SDL_PixelFormat * format, Uint32 flags)
} }
modes[nmodes]->x = 0; modes[nmodes]->x = 0;
modes[nmodes]->y = 0; modes[nmodes]->y = 0;
modes[nmodes]->w = mode->w; modes[nmodes]->w = mode.w;
modes[nmodes]->h = mode->h; modes[nmodes]->h = mode.h;
++nmodes; ++nmodes;
} }
if (modes) { if (modes) {
...@@ -300,16 +305,17 @@ GetEnvironmentWindowPosition(int w, int h, int *x, int *y) ...@@ -300,16 +305,17 @@ GetEnvironmentWindowPosition(int w, int h, int *x, int *y)
} }
} }
if (center) { if (center) {
const SDL_DisplayMode *current = SDL_GetDesktopDisplayMode(); SDL_DisplayMode mode;
*x = (current->w - w) / 2; SDL_GetDesktopDisplayMode(&mode);
*y = (current->h - h) / 2; *x = (mode.w - w) / 2;
*y = (mode.h - h) / 2;
} }
} }
SDL_Surface * SDL_Surface *
SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
{ {
const SDL_DisplayMode *desktop_mode; SDL_DisplayMode desktop_mode;
SDL_DisplayMode mode; SDL_DisplayMode mode;
int window_x = SDL_WINDOWPOS_UNDEFINED; int window_x = SDL_WINDOWPOS_UNDEFINED;
int window_y = SDL_WINDOWPOS_UNDEFINED; int window_y = SDL_WINDOWPOS_UNDEFINED;
...@@ -390,8 +396,8 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) ...@@ -390,8 +396,8 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
} }
/* Set up the desired display mode */ /* Set up the desired display mode */
desktop_mode = SDL_GetDesktopDisplayMode(); SDL_GetDesktopDisplayMode(&desktop_mode);
desktop_format = desktop_mode->format; desktop_format = desktop_mode.format;
if (desktop_format && ((flags & SDL_ANYFORMAT) if (desktop_format && ((flags & SDL_ANYFORMAT)
|| (bpp == SDL_BITSPERPIXEL(desktop_format)))) { || (bpp == SDL_BITSPERPIXEL(desktop_format)))) {
desired_format = desktop_format; desired_format = desktop_format;
......
...@@ -422,33 +422,44 @@ SDL_GetNumDisplayModes() ...@@ -422,33 +422,44 @@ SDL_GetNumDisplayModes()
return 0; return 0;
} }
const SDL_DisplayMode * int
SDL_GetDisplayMode(int index) SDL_GetDisplayMode(int index, SDL_DisplayMode * mode)
{ {
if (index < 0 || index >= SDL_GetNumDisplayModes()) { if (index < 0 || index >= SDL_GetNumDisplayModes()) {
SDL_SetError("index must be in the range of 0 - %d", SDL_SetError("index must be in the range of 0 - %d",
SDL_GetNumDisplayModes() - 1); SDL_GetNumDisplayModes() - 1);
return NULL; return -1;
}
if (mode) {
*mode = SDL_CurrentDisplay.display_modes[index];
} }
return &SDL_CurrentDisplay.display_modes[index]; return 0;
} }
const SDL_DisplayMode * int
SDL_GetDesktopDisplayMode(void) SDL_GetDesktopDisplayMode(SDL_DisplayMode * mode)
{ {
if (_this) { if (!_this) {
return &SDL_CurrentDisplay.desktop_mode; SDL_UninitializedVideo();
return -1;
} }
return NULL; if (mode) {
*mode = SDL_CurrentDisplay.desktop_mode;
}
return 0;
} }
const SDL_DisplayMode * int
SDL_GetCurrentDisplayMode(void) SDL_GetCurrentDisplayMode(SDL_DisplayMode * mode)
{ {
if (_this) { if (!_this) {
return &SDL_CurrentDisplay.current_mode; SDL_UninitializedVideo();
return -1;
} }
return NULL; if (mode) {
*mode = SDL_CurrentDisplay.current_mode;
}
return 0;
} }
SDL_DisplayMode * SDL_DisplayMode *
...@@ -549,6 +560,7 @@ SDL_SetDisplayMode(const SDL_DisplayMode * mode) ...@@ -549,6 +560,7 @@ SDL_SetDisplayMode(const SDL_DisplayMode * mode)
{ {
SDL_VideoDisplay *display; SDL_VideoDisplay *display;
SDL_DisplayMode display_mode; SDL_DisplayMode display_mode;
SDL_DisplayMode current_mode;
int i, ncolors; int i, ncolors;
if (!_this) { if (!_this) {
...@@ -556,10 +568,10 @@ SDL_SetDisplayMode(const SDL_DisplayMode * mode) ...@@ -556,10 +568,10 @@ SDL_SetDisplayMode(const SDL_DisplayMode * mode)
return -1; return -1;
} }
display = &SDL_CurrentDisplay;
if (!mode) { if (!mode) {
mode = SDL_GetDesktopDisplayMode(); mode = &display->desktop_mode;
} }
display = &SDL_CurrentDisplay;
display_mode = *mode; display_mode = *mode;
/* Default to the current mode */ /* Default to the current mode */
...@@ -584,9 +596,8 @@ SDL_SetDisplayMode(const SDL_DisplayMode * mode) ...@@ -584,9 +596,8 @@ SDL_SetDisplayMode(const SDL_DisplayMode * mode)
} }
/* See if there's anything left to do */ /* See if there's anything left to do */
if (SDL_memcmp SDL_GetCurrentDisplayMode(&current_mode);
(&display_mode, SDL_GetCurrentDisplayMode(), if (SDL_memcmp(&display_mode, &current_mode, sizeof(display_mode)) == 0) {
sizeof(display_mode)) == 0) {
return 0; return 0;
} }
...@@ -659,13 +670,17 @@ SDL_SetFullscreenDisplayMode(const SDL_DisplayMode * mode) ...@@ -659,13 +670,17 @@ SDL_SetFullscreenDisplayMode(const SDL_DisplayMode * mode)
return 0; return 0;
} }
const SDL_DisplayMode * int
SDL_GetFullscreenDisplayMode(void) SDL_GetFullscreenDisplayMode(SDL_DisplayMode * mode)
{ {
if (_this) { if (!_this) {
return SDL_CurrentDisplay.fullscreen_mode; SDL_UninitializedVideo();
return -1;
} }
return NULL; if (mode) {
*mode = *SDL_CurrentDisplay.fullscreen_mode;
}
return 0;
} }
int int
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#define _SDL_cocoakeyboard_h #define _SDL_cocoakeyboard_h
extern void Cocoa_InitKeyboard(_THIS); extern void Cocoa_InitKeyboard(_THIS);
extern void Cocoa_HandleKeyEvent(_THIS, NSEvent *event); extern void Cocoa_HandleKeyEvent(_THIS, NSEvent * event);
extern void Cocoa_QuitKeyboard(_THIS); extern void Cocoa_QuitKeyboard(_THIS);
#endif /* _SDL_cocoakeyboard_h */ #endif /* _SDL_cocoakeyboard_h */
......
...@@ -545,7 +545,7 @@ CommonInit(CommonState * state) ...@@ -545,7 +545,7 @@ CommonInit(CommonState * state)
} }
if (state->verbose & VERBOSE_MODES) { if (state->verbose & VERBOSE_MODES) {
const SDL_DisplayMode *mode; SDL_DisplayMode mode;
int bpp; int bpp;
Uint32 Rmask, Gmask, Bmask, Amask; Uint32 Rmask, Gmask, Bmask, Amask;
...@@ -555,12 +555,12 @@ CommonInit(CommonState * state) ...@@ -555,12 +555,12 @@ CommonInit(CommonState * state)
fprintf(stderr, "Display %d:\n", i); fprintf(stderr, "Display %d:\n", i);
SDL_SelectVideoDisplay(i); SDL_SelectVideoDisplay(i);
mode = SDL_GetDesktopDisplayMode(); SDL_GetDesktopDisplayMode(&mode);
SDL_PixelFormatEnumToMasks(mode->format, &bpp, &Rmask, &Gmask, SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask,
&Bmask, &Amask); &Bmask, &Amask);
fprintf(stderr, fprintf(stderr,
" Current mode: %dx%d@%dHz, %d bits-per-pixel\n", " Current mode: %dx%d@%dHz, %d bits-per-pixel\n",
mode->w, mode->h, mode->refresh_rate, bpp); mode.w, mode.h, mode.refresh_rate, bpp);
if (Rmask || Gmask || Bmask) { if (Rmask || Gmask || Bmask) {
fprintf(stderr, " Red Mask = 0x%.8x\n", Rmask); fprintf(stderr, " Red Mask = 0x%.8x\n", Rmask);
fprintf(stderr, " Green Mask = 0x%.8x\n", Gmask); fprintf(stderr, " Green Mask = 0x%.8x\n", Gmask);
...@@ -576,12 +576,12 @@ CommonInit(CommonState * state) ...@@ -576,12 +576,12 @@ CommonInit(CommonState * state)
} else { } else {
fprintf(stderr, " Fullscreen video modes:\n"); fprintf(stderr, " Fullscreen video modes:\n");
for (j = 0; j < m; ++j) { for (j = 0; j < m; ++j) {
mode = SDL_GetDisplayMode(j); SDL_GetDisplayMode(j, &mode);
SDL_PixelFormatEnumToMasks(mode->format, &bpp, &Rmask, SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask,
&Gmask, &Bmask, &Amask); &Gmask, &Bmask, &Amask);
fprintf(stderr, fprintf(stderr,
" Mode %d: %dx%d@%dHz, %d bits-per-pixel\n", " Mode %d: %dx%d@%dHz, %d bits-per-pixel\n",
j, mode->w, mode->h, mode->refresh_rate, bpp); j, mode.w, mode.h, mode.refresh_rate, bpp);
if (Rmask || Gmask || Bmask) { if (Rmask || Gmask || Bmask) {
fprintf(stderr, " Red Mask = 0x%.8x\n", fprintf(stderr, " Red Mask = 0x%.8x\n",
Rmask); Rmask);
......
...@@ -165,6 +165,7 @@ main(int argc, char *argv[]) ...@@ -165,6 +165,7 @@ main(int argc, char *argv[])
int fsaa, accel; int fsaa, accel;
int value; int value;
int i, done; int i, done;
SDL_DisplayMode mode;
SDL_Event event; SDL_Event event;
Uint32 then, now, frames; Uint32 then, now, frames;
...@@ -235,8 +236,8 @@ main(int argc, char *argv[]) ...@@ -235,8 +236,8 @@ main(int argc, char *argv[])
SDL_GL_SetSwapInterval(0); SDL_GL_SetSwapInterval(0);
} }
printf("Screen BPP: %d\n", SDL_GetCurrentDisplayMode(&mode);
SDL_BITSPERPIXEL(SDL_GetCurrentDisplayMode()->format)); printf("Screen BPP: %d\n", SDL_BITSPERPIXEL(mode.format));
printf("\n"); printf("\n");
printf("Vendor : %s\n", glGetString(GL_VENDOR)); printf("Vendor : %s\n", glGetString(GL_VENDOR));
printf("Renderer : %s\n", glGetString(GL_RENDERER)); printf("Renderer : %s\n", glGetString(GL_RENDERER));
......
...@@ -419,7 +419,7 @@ main(int argc, char *argv[]) ...@@ -419,7 +419,7 @@ main(int argc, char *argv[])
const SDL_VideoInfo *info; const SDL_VideoInfo *info;
int i, d, n; int i, d, n;
const char *driver; const char *driver;
const SDL_DisplayMode *mode; SDL_DisplayMode mode;
int bpp; int bpp;
Uint32 Rmask, Gmask, Bmask, Amask; Uint32 Rmask, Gmask, Bmask, Amask;
int nmodes; int nmodes;
...@@ -452,11 +452,11 @@ main(int argc, char *argv[]) ...@@ -452,11 +452,11 @@ main(int argc, char *argv[])
printf("Display %d:\n", d); printf("Display %d:\n", d);
SDL_SelectVideoDisplay(d); SDL_SelectVideoDisplay(d);
mode = SDL_GetDesktopDisplayMode(); SDL_GetDesktopDisplayMode(&mode);
SDL_PixelFormatEnumToMasks(mode->format, &bpp, &Rmask, &Gmask, &Bmask, SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, &Bmask,
&Amask); &Amask);
printf(" Current mode: %dx%d@%dHz, %d bits-per-pixel\n", mode->w, printf(" Current mode: %dx%d@%dHz, %d bits-per-pixel\n", mode.w,
mode->h, mode->refresh_rate, bpp); mode.h, mode.refresh_rate, bpp);
if (Rmask || Gmask || Bmask) { if (Rmask || Gmask || Bmask) {
printf(" Red Mask = 0x%.8x\n", Rmask); printf(" Red Mask = 0x%.8x\n", Rmask);
printf(" Green Mask = 0x%.8x\n", Gmask); printf(" Green Mask = 0x%.8x\n", Gmask);
...@@ -472,11 +472,11 @@ main(int argc, char *argv[]) ...@@ -472,11 +472,11 @@ main(int argc, char *argv[])
} else { } else {
printf(" Fullscreen video modes:\n"); printf(" Fullscreen video modes:\n");
for (i = 0; i < nmodes; ++i) { for (i = 0; i < nmodes; ++i) {
mode = SDL_GetDisplayMode(i); SDL_GetDisplayMode(i, &mode);
SDL_PixelFormatEnumToMasks(mode->format, &bpp, &Rmask, SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask,
&Gmask, &Bmask, &Amask); &Gmask, &Bmask, &Amask);
printf(" Mode %d: %dx%d@%dHz, %d bits-per-pixel\n", i, printf(" Mode %d: %dx%d@%dHz, %d bits-per-pixel\n", i,
mode->w, mode->h, mode->refresh_rate, bpp); mode.w, mode.h, mode.refresh_rate, bpp);
if (Rmask || Gmask || Bmask) { if (Rmask || Gmask || Bmask) {
printf(" Red Mask = 0x%.8x\n", Rmask); printf(" Red Mask = 0x%.8x\n", Rmask);
printf(" Green Mask = 0x%.8x\n", Gmask); printf(" Green Mask = 0x%.8x\n", Gmask);
......
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