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

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402014
This commit is contained in:
Sam Lantinga 2006-08-05 22:34:23 +00:00
parent ade506e8d5
commit a90680c736
8 changed files with 111 additions and 85 deletions

View file

@ -545,7 +545,7 @@ CommonInit(CommonState * state)
}
if (state->verbose & VERBOSE_MODES) {
const SDL_DisplayMode *mode;
SDL_DisplayMode mode;
int bpp;
Uint32 Rmask, Gmask, Bmask, Amask;
@ -555,12 +555,12 @@ CommonInit(CommonState * state)
fprintf(stderr, "Display %d:\n", i);
SDL_SelectVideoDisplay(i);
mode = SDL_GetDesktopDisplayMode();
SDL_PixelFormatEnumToMasks(mode->format, &bpp, &Rmask, &Gmask,
SDL_GetDesktopDisplayMode(&mode);
SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask,
&Bmask, &Amask);
fprintf(stderr,
" 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) {
fprintf(stderr, " Red Mask = 0x%.8x\n", Rmask);
fprintf(stderr, " Green Mask = 0x%.8x\n", Gmask);
@ -576,12 +576,12 @@ CommonInit(CommonState * state)
} else {
fprintf(stderr, " Fullscreen video modes:\n");
for (j = 0; j < m; ++j) {
mode = SDL_GetDisplayMode(j);
SDL_PixelFormatEnumToMasks(mode->format, &bpp, &Rmask,
SDL_GetDisplayMode(j, &mode);
SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask,
&Gmask, &Bmask, &Amask);
fprintf(stderr,
" 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) {
fprintf(stderr, " Red Mask = 0x%.8x\n",
Rmask);

View file

@ -165,6 +165,7 @@ main(int argc, char *argv[])
int fsaa, accel;
int value;
int i, done;
SDL_DisplayMode mode;
SDL_Event event;
Uint32 then, now, frames;
@ -235,8 +236,8 @@ main(int argc, char *argv[])
SDL_GL_SetSwapInterval(0);
}
printf("Screen BPP: %d\n",
SDL_BITSPERPIXEL(SDL_GetCurrentDisplayMode()->format));
SDL_GetCurrentDisplayMode(&mode);
printf("Screen BPP: %d\n", SDL_BITSPERPIXEL(mode.format));
printf("\n");
printf("Vendor : %s\n", glGetString(GL_VENDOR));
printf("Renderer : %s\n", glGetString(GL_RENDERER));

View file

@ -419,7 +419,7 @@ main(int argc, char *argv[])
const SDL_VideoInfo *info;
int i, d, n;
const char *driver;
const SDL_DisplayMode *mode;
SDL_DisplayMode mode;
int bpp;
Uint32 Rmask, Gmask, Bmask, Amask;
int nmodes;
@ -452,11 +452,11 @@ main(int argc, char *argv[])
printf("Display %d:\n", d);
SDL_SelectVideoDisplay(d);
mode = SDL_GetDesktopDisplayMode();
SDL_PixelFormatEnumToMasks(mode->format, &bpp, &Rmask, &Gmask, &Bmask,
SDL_GetDesktopDisplayMode(&mode);
SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, &Bmask,
&Amask);
printf(" Current mode: %dx%d@%dHz, %d bits-per-pixel\n", mode->w,
mode->h, mode->refresh_rate, bpp);
printf(" Current mode: %dx%d@%dHz, %d bits-per-pixel\n", mode.w,
mode.h, mode.refresh_rate, bpp);
if (Rmask || Gmask || Bmask) {
printf(" Red Mask = 0x%.8x\n", Rmask);
printf(" Green Mask = 0x%.8x\n", Gmask);
@ -472,11 +472,11 @@ main(int argc, char *argv[])
} else {
printf(" Fullscreen video modes:\n");
for (i = 0; i < nmodes; ++i) {
mode = SDL_GetDisplayMode(i);
SDL_PixelFormatEnumToMasks(mode->format, &bpp, &Rmask,
SDL_GetDisplayMode(i, &mode);
SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask,
&Gmask, &Bmask, &Amask);
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) {
printf(" Red Mask = 0x%.8x\n", Rmask);
printf(" Green Mask = 0x%.8x\n", Gmask);