Commit 21c236f4 authored by Sam Lantinga's avatar Sam Lantinga

Date: Sun, 27 Jul 2003 22:37:59 +0200

From: Max Horn
Subject: SDL whitespace patch

this patch is lowest priority: it only contains indention fixes. In
some places, instead of tabs, whitespaces where used for indention. But
of course that only "looks good" if you use the exact same tab width as
the author of those files. I tried to replace such cases with tabs for
a more uniform indention. I only did that for a few files.

So, no code changes in this, only whitespaces transformed.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40663
parent b15dbed4
...@@ -260,7 +260,7 @@ int SDL_VideoInit (const char *driver_name, Uint32 flags) ...@@ -260,7 +260,7 @@ int SDL_VideoInit (const char *driver_name, Uint32 flags)
*/ */
/* If we have a palettized surface, create a default palette */ /* If we have a palettized surface, create a default palette */
if ( SDL_VideoSurface->format->palette ) { if ( SDL_VideoSurface->format->palette ) {
SDL_PixelFormat *vf = SDL_VideoSurface->format; SDL_PixelFormat *vf = SDL_VideoSurface->format;
SDL_DitherColors(vf->palette->colors, vf->BitsPerPixel); SDL_DitherColors(vf->palette->colors, vf->BitsPerPixel);
video->SetColors(video, video->SetColors(video,
0, vf->palette->ncolors, vf->palette->colors); 0, vf->palette->ncolors, vf->palette->colors);
...@@ -633,7 +633,7 @@ SDL_Surface * SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags) ...@@ -633,7 +633,7 @@ SDL_Surface * SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags)
video->physpal = NULL; video->physpal = NULL;
} }
if( video->gammacols) { if( video->gammacols) {
free(video->gammacols); free(video->gammacols);
video->gammacols = NULL; video->gammacols = NULL;
} }
...@@ -652,7 +652,7 @@ SDL_Surface * SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags) ...@@ -652,7 +652,7 @@ SDL_Surface * SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags)
if ( is_opengl && !(mode->flags & SDL_OPENGL) ) { if ( is_opengl && !(mode->flags & SDL_OPENGL) ) {
mode = NULL; mode = NULL;
} }
} }
/* /*
* rcg11292000 * rcg11292000
* If you try to set an SDL_OPENGL surface, and fail to find a * If you try to set an SDL_OPENGL surface, and fail to find a
...@@ -675,7 +675,7 @@ SDL_Surface * SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags) ...@@ -675,7 +675,7 @@ SDL_Surface * SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags)
/* If we have a palettized surface, create a default palette */ /* If we have a palettized surface, create a default palette */
if ( mode->format->palette ) { if ( mode->format->palette ) {
SDL_PixelFormat *vf = mode->format; SDL_PixelFormat *vf = mode->format;
SDL_DitherColors(vf->palette->colors, vf->BitsPerPixel); SDL_DitherColors(vf->palette->colors, vf->BitsPerPixel);
video->SetColors(this, 0, vf->palette->ncolors, video->SetColors(this, 0, vf->palette->ncolors,
vf->palette->colors); vf->palette->colors);
...@@ -805,7 +805,7 @@ do { \ ...@@ -805,7 +805,7 @@ do { \
/* Free the original video mode surface (is this safe?) */ /* Free the original video mode surface (is this safe?) */
SDL_FreeSurface(mode); SDL_FreeSurface(mode);
/* Set the surface completely opaque & white by default */ /* Set the surface completely opaque & white by default */
memset( SDL_VideoSurface->pixels, 255, SDL_VideoSurface->h * SDL_VideoSurface->pitch ); memset( SDL_VideoSurface->pixels, 255, SDL_VideoSurface->h * SDL_VideoSurface->pitch );
video->glGenTextures( 1, &video->texture ); video->glGenTextures( 1, &video->texture );
video->glBindTexture( GL_TEXTURE_2D, video->texture ); video->glBindTexture( GL_TEXTURE_2D, video->texture );
...@@ -1093,17 +1093,17 @@ int SDL_Flip(SDL_Surface *screen) ...@@ -1093,17 +1093,17 @@ int SDL_Flip(SDL_Surface *screen)
static void SetPalette_logical(SDL_Surface *screen, SDL_Color *colors, static void SetPalette_logical(SDL_Surface *screen, SDL_Color *colors,
int firstcolor, int ncolors) int firstcolor, int ncolors)
{ {
SDL_Palette *pal = screen->format->palette; SDL_Palette *pal = screen->format->palette;
SDL_Palette *vidpal; SDL_Palette *vidpal;
if ( colors != (pal->colors + firstcolor) ) { if ( colors != (pal->colors + firstcolor) ) {
memcpy(pal->colors + firstcolor, colors, memcpy(pal->colors + firstcolor, colors,
ncolors * sizeof(*colors)); ncolors * sizeof(*colors));
} }
vidpal = SDL_VideoSurface->format->palette; vidpal = SDL_VideoSurface->format->palette;
if ( (screen == SDL_ShadowSurface) && vidpal ) { if ( (screen == SDL_ShadowSurface) && vidpal ) {
/* /*
* This is a shadow surface, and the physical * This is a shadow surface, and the physical
* framebuffer is also indexed. Propagate the * framebuffer is also indexed. Propagate the
* changes to its logical palette so that * changes to its logical palette so that
...@@ -1170,8 +1170,8 @@ static int SetPalette_physical(SDL_Surface *screen, ...@@ -1170,8 +1170,8 @@ static int SetPalette_physical(SDL_Surface *screen,
if ( screen == SDL_VideoSurface ) { if ( screen == SDL_VideoSurface ) {
SDL_Color gcolors[256]; SDL_Color gcolors[256];
if ( video->gamma ) { if ( video->gamma ) {
SDL_ApplyGamma(video->gamma, colors, gcolors, ncolors); SDL_ApplyGamma(video->gamma, colors, gcolors, ncolors);
colors = gcolors; colors = gcolors;
} }
gotall = video->SetColors(video, firstcolor, ncolors, colors); gotall = video->SetColors(video, firstcolor, ncolors, colors);
...@@ -1199,7 +1199,7 @@ static int SetPalette_physical(SDL_Surface *screen, ...@@ -1199,7 +1199,7 @@ static int SetPalette_physical(SDL_Surface *screen,
int SDL_SetPalette(SDL_Surface *screen, int which, int SDL_SetPalette(SDL_Surface *screen, int which,
SDL_Color *colors, int firstcolor, int ncolors) SDL_Color *colors, int firstcolor, int ncolors)
{ {
SDL_Palette *pal; SDL_Palette *pal;
int gotall; int gotall;
int palsize; int palsize;
...@@ -1207,22 +1207,22 @@ int SDL_SetPalette(SDL_Surface *screen, int which, ...@@ -1207,22 +1207,22 @@ int SDL_SetPalette(SDL_Surface *screen, int which,
return 0; return 0;
} }
if ( screen != SDL_PublicSurface ) { if ( screen != SDL_PublicSurface ) {
/* only screens have physical palettes */ /* only screens have physical palettes */
which &= ~SDL_PHYSPAL; which &= ~SDL_PHYSPAL;
} else if( (screen->flags & SDL_HWPALETTE) != SDL_HWPALETTE ) { } else if( (screen->flags & SDL_HWPALETTE) != SDL_HWPALETTE ) {
/* hardware palettes required for split colormaps */ /* hardware palettes required for split colormaps */
which |= SDL_PHYSPAL | SDL_LOGPAL; which |= SDL_PHYSPAL | SDL_LOGPAL;
} }
/* Verify the parameters */ /* Verify the parameters */
pal = screen->format->palette; pal = screen->format->palette;
if( !pal ) { if( !pal ) {
return 0; /* not a palettized surface */ return 0; /* not a palettized surface */
} }
gotall = 1; gotall = 1;
palsize = 1 << screen->format->BitsPerPixel; palsize = 1 << screen->format->BitsPerPixel;
if ( ncolors > (palsize - firstcolor) ) { if ( ncolors > (palsize - firstcolor) ) {
ncolors = (palsize - firstcolor); ncolors = (palsize - firstcolor);
gotall = 0; gotall = 0;
} }
...@@ -1233,20 +1233,20 @@ int SDL_SetPalette(SDL_Surface *screen, int which, ...@@ -1233,20 +1233,20 @@ int SDL_SetPalette(SDL_Surface *screen, int which,
* interpretation of the pixel values (for blits etc) is * interpretation of the pixel values (for blits etc) is
* changed. * changed.
*/ */
SetPalette_logical(screen, colors, firstcolor, ncolors); SetPalette_logical(screen, colors, firstcolor, ncolors);
} }
if ( which & SDL_PHYSPAL ) { if ( which & SDL_PHYSPAL ) {
SDL_VideoDevice *video = current_video; SDL_VideoDevice *video = current_video;
/* /*
* Physical palette change: This doesn't affect the * Physical palette change: This doesn't affect the
* program's idea of what the screen looks like, but changes * program's idea of what the screen looks like, but changes
* its actual appearance. * its actual appearance.
*/ */
if(!video) if(!video)
return gotall; /* video not yet initialized */ return gotall; /* video not yet initialized */
if(!video->physpal && !(which & SDL_LOGPAL) ) { if(!video->physpal && !(which & SDL_LOGPAL) ) {
/* Lazy physical palette allocation */ /* Lazy physical palette allocation */
int size; int size;
SDL_Palette *pp = malloc(sizeof(*pp)); SDL_Palette *pp = malloc(sizeof(*pp));
current_video->physpal = pp; current_video->physpal = pp;
pp->ncolors = pal->ncolors; pp->ncolors = pal->ncolors;
...@@ -1265,7 +1265,7 @@ int SDL_SetPalette(SDL_Surface *screen, int which, ...@@ -1265,7 +1265,7 @@ int SDL_SetPalette(SDL_Surface *screen, int which,
int SDL_SetColors(SDL_Surface *screen, SDL_Color *colors, int firstcolor, int SDL_SetColors(SDL_Surface *screen, SDL_Color *colors, int firstcolor,
int ncolors) int ncolors)
{ {
return SDL_SetPalette(screen, SDL_LOGPAL | SDL_PHYSPAL, return SDL_SetPalette(screen, SDL_LOGPAL | SDL_PHYSPAL,
colors, firstcolor, ncolors); colors, firstcolor, ncolors);
} }
...@@ -1398,8 +1398,8 @@ int SDL_GL_SetAttribute( SDL_GLattr attr, int value ) ...@@ -1398,8 +1398,8 @@ int SDL_GL_SetAttribute( SDL_GLattr attr, int value )
case SDL_GL_DOUBLEBUFFER: case SDL_GL_DOUBLEBUFFER:
video->gl_config.double_buffer = value; video->gl_config.double_buffer = value;
break; break;
case SDL_GL_BUFFER_SIZE: case SDL_GL_BUFFER_SIZE:
video->gl_config.buffer_size = value; video->gl_config.buffer_size = value;
break; break;
case SDL_GL_DEPTH_SIZE: case SDL_GL_DEPTH_SIZE:
video->gl_config.depth_size = value; video->gl_config.depth_size = value;
......
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