Ran source code through "indent -nbfda -npcs -npsl -bli0".

This commit is contained in:
William Kendrick 2006-08-27 21:00:52 +00:00
parent 51355bce43
commit 7716a05281
38 changed files with 10816 additions and 10710 deletions

View file

@ -34,169 +34,177 @@
/* Draw a single pixel into the surface: */
void putpixel8(SDL_Surface * surface, int x, int y, Uint32 pixel)
{
Uint8 * p;
Uint8 *p;
/* Assuming the X/Y values are within the bounds of this surface... */
if (likely( likely((unsigned)x<(unsigned)surface->w) && likely((unsigned)y<(unsigned)surface->h) ))
{
// Set a pointer to the exact location in memory of the pixel
p = (Uint8 *) (((Uint8 *)surface->pixels) + /* Start: beginning of RAM */
(y * surface->pitch) + /* Go down Y lines */
x); /* Go in X pixels */
if (likely
(likely((unsigned) x < (unsigned) surface->w)
&& likely((unsigned) y < (unsigned) surface->h)))
{
// Set a pointer to the exact location in memory of the pixel
p = (Uint8 *) (((Uint8 *) surface->pixels) + /* Start: beginning of RAM */
(y * surface->pitch) + /* Go down Y lines */
x); /* Go in X pixels */
/* Set the (correctly-sized) piece of data in the surface's RAM
* to the pixel value sent in: */
/* Set the (correctly-sized) piece of data in the surface's RAM
* to the pixel value sent in: */
*p = pixel;
}
*p = pixel;
}
}
/* Draw a single pixel into the surface: */
void putpixel16(SDL_Surface * surface, int x, int y, Uint32 pixel)
{
Uint8 * p;
Uint8 *p;
/* Assuming the X/Y values are within the bounds of this surface... */
if (likely( likely((unsigned)x<(unsigned)surface->w) && likely((unsigned)y<(unsigned)surface->h) ))
{
// Set a pointer to the exact location in memory of the pixel
p = (Uint8 *) (((Uint8 *)surface->pixels) + /* Start: beginning of RAM */
(y * surface->pitch) + /* Go down Y lines */
(x * 2)); /* Go in X pixels */
if (likely
(likely((unsigned) x < (unsigned) surface->w)
&& likely((unsigned) y < (unsigned) surface->h)))
{
// Set a pointer to the exact location in memory of the pixel
p = (Uint8 *) (((Uint8 *) surface->pixels) + /* Start: beginning of RAM */
(y * surface->pitch) + /* Go down Y lines */
(x * 2)); /* Go in X pixels */
/* Set the (correctly-sized) piece of data in the surface's RAM
* to the pixel value sent in: */
/* Set the (correctly-sized) piece of data in the surface's RAM
* to the pixel value sent in: */
*(Uint16 *)p = pixel;
}
*(Uint16 *) p = pixel;
}
}
/* Draw a single pixel into the surface: */
void putpixel24(SDL_Surface * surface, int x, int y, Uint32 pixel)
{
Uint8 * p;
Uint8 *p;
/* Assuming the X/Y values are within the bounds of this surface... */
if (likely( likely((unsigned)x<(unsigned)surface->w) && likely((unsigned)y<(unsigned)surface->h) ))
if (likely
(likely((unsigned) x < (unsigned) surface->w)
&& likely((unsigned) y < (unsigned) surface->h)))
{
// Set a pointer to the exact location in memory of the pixel
p = (Uint8 *) (((Uint8 *) surface->pixels) + /* Start: beginning of RAM */
(y * surface->pitch) + /* Go down Y lines */
(x * 3)); /* Go in X pixels */
/* Set the (correctly-sized) piece of data in the surface's RAM
* to the pixel value sent in: */
if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
{
// Set a pointer to the exact location in memory of the pixel
p = (Uint8 *) (((Uint8 *)surface->pixels) + /* Start: beginning of RAM */
(y * surface->pitch) + /* Go down Y lines */
(x * 3)); /* Go in X pixels */
/* Set the (correctly-sized) piece of data in the surface's RAM
* to the pixel value sent in: */
if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
{
p[0] = (pixel >> 16) & 0xff;
p[1] = (pixel >> 8) & 0xff;
p[2] = pixel & 0xff;
}
else
{
p[0] = pixel & 0xff;
p[1] = (pixel >> 8) & 0xff;
p[2] = (pixel >> 16) & 0xff;
}
p[0] = (pixel >> 16) & 0xff;
p[1] = (pixel >> 8) & 0xff;
p[2] = pixel & 0xff;
}
else
{
p[0] = pixel & 0xff;
p[1] = (pixel >> 8) & 0xff;
p[2] = (pixel >> 16) & 0xff;
}
}
}
/* Draw a single pixel into the surface: */
void putpixel32(SDL_Surface * surface, int x, int y, Uint32 pixel)
{
Uint8 * p;
Uint8 *p;
/* Assuming the X/Y values are within the bounds of this surface... */
if (likely( likely((unsigned)x<(unsigned)surface->w) && likely((unsigned)y<(unsigned)surface->h) ))
{
// Set a pointer to the exact location in memory of the pixel
p = (Uint8 *) (((Uint8 *)surface->pixels) + /* Start: beginning of RAM */
(y * surface->pitch) + /* Go down Y lines */
(x * 4)); /* Go in X pixels */
if (likely
(likely((unsigned) x < (unsigned) surface->w)
&& likely((unsigned) y < (unsigned) surface->h)))
{
// Set a pointer to the exact location in memory of the pixel
p = (Uint8 *) (((Uint8 *) surface->pixels) + /* Start: beginning of RAM */
(y * surface->pitch) + /* Go down Y lines */
(x * 4)); /* Go in X pixels */
/* Set the (correctly-sized) piece of data in the surface's RAM
* to the pixel value sent in: */
/* Set the (correctly-sized) piece of data in the surface's RAM
* to the pixel value sent in: */
*(Uint32 *)p = pixel; // 32-bit display
}
*(Uint32 *) p = pixel; // 32-bit display
}
}
/* Get a pixel: */
Uint32 getpixel8(SDL_Surface * surface, int x, int y)
{
Uint8 * p;
Uint8 *p;
/* get the X/Y values within the bounds of this surface */
if (unlikely( (unsigned)x > (unsigned)surface->w - 1u ))
x = (x<0) ? 0 : surface->w - 1;
if (unlikely( (unsigned)y > (unsigned)surface->h - 1u ))
y = (y<0) ? 0 : surface->h - 1;
if (unlikely((unsigned) x > (unsigned) surface->w - 1u))
x = (x < 0) ? 0 : surface->w - 1;
if (unlikely((unsigned) y > (unsigned) surface->h - 1u))
y = (y < 0) ? 0 : surface->h - 1;
/* Set a pointer to the exact location in memory of the pixel
in question: */
p = (Uint8 *) (((Uint8 *)surface->pixels) + /* Start at top of RAM */
(y * surface->pitch) + /* Go down Y lines */
x); /* Go in X pixels */
p = (Uint8 *) (((Uint8 *) surface->pixels) + /* Start at top of RAM */
(y * surface->pitch) + /* Go down Y lines */
x); /* Go in X pixels */
/* Return the correctly-sized piece of data containing the
* pixel's value (an 8-bit palette value, or a 16-, 24- or 32-bit
* RGB value) */
return(*p);
return (*p);
}
/* Get a pixel: */
Uint32 getpixel16(SDL_Surface * surface, int x, int y)
{
Uint8 * p;
Uint8 *p;
/* get the X/Y values within the bounds of this surface */
if (unlikely( (unsigned)x > (unsigned)surface->w - 1u ))
x = (x<0) ? 0 : surface->w - 1;
if (unlikely( (unsigned)y > (unsigned)surface->h - 1u ))
y = (y<0) ? 0 : surface->h - 1;
if (unlikely((unsigned) x > (unsigned) surface->w - 1u))
x = (x < 0) ? 0 : surface->w - 1;
if (unlikely((unsigned) y > (unsigned) surface->h - 1u))
y = (y < 0) ? 0 : surface->h - 1;
/* Set a pointer to the exact location in memory of the pixel
in question: */
p = (Uint8 *) (((Uint8 *)surface->pixels) + /* Start at top of RAM */
(y * surface->pitch) + /* Go down Y lines */
(x * 2)); /* Go in X pixels */
p = (Uint8 *) (((Uint8 *) surface->pixels) + /* Start at top of RAM */
(y * surface->pitch) + /* Go down Y lines */
(x * 2)); /* Go in X pixels */
/* Return the correctly-sized piece of data containing the
* pixel's value (an 8-bit palette value, or a 16-, 24- or 32-bit
* RGB value) */
return(*(Uint16 *)p);
return (*(Uint16 *) p);
}
/* Get a pixel: */
Uint32 getpixel24(SDL_Surface * surface, int x, int y)
{
Uint8 * p;
Uint8 *p;
Uint32 pixel;
/* get the X/Y values within the bounds of this surface */
if (unlikely( (unsigned)x > (unsigned)surface->w - 1u ))
x = (x<0) ? 0 : surface->w - 1;
if (unlikely( (unsigned)y > (unsigned)surface->h - 1u ))
y = (y<0) ? 0 : surface->h - 1;
if (unlikely((unsigned) x > (unsigned) surface->w - 1u))
x = (x < 0) ? 0 : surface->w - 1;
if (unlikely((unsigned) y > (unsigned) surface->h - 1u))
y = (y < 0) ? 0 : surface->h - 1;
/* Set a pointer to the exact location in memory of the pixel
in question: */
p = (Uint8 *) (((Uint8 *)surface->pixels) + /* Start at top of RAM */
(y * surface->pitch) + /* Go down Y lines */
(x * 3)); /* Go in X pixels */
p = (Uint8 *) (((Uint8 *) surface->pixels) + /* Start at top of RAM */
(y * surface->pitch) + /* Go down Y lines */
(x * 3)); /* Go in X pixels */
/* Return the correctly-sized piece of data containing the
@ -216,33 +224,34 @@ Uint32 getpixel24(SDL_Surface * surface, int x, int y)
/* Get a pixel: */
Uint32 getpixel32(SDL_Surface * surface, int x, int y)
{
Uint8 * p;
Uint8 *p;
/* get the X/Y values within the bounds of this surface */
if (unlikely( (unsigned)x > (unsigned)surface->w - 1u ))
x = (x<0) ? 0 : surface->w - 1;
if (unlikely( (unsigned)y > (unsigned)surface->h - 1u ))
y = (y<0) ? 0 : surface->h - 1;
if (unlikely((unsigned) x > (unsigned) surface->w - 1u))
x = (x < 0) ? 0 : surface->w - 1;
if (unlikely((unsigned) y > (unsigned) surface->h - 1u))
y = (y < 0) ? 0 : surface->h - 1;
/* Set a pointer to the exact location in memory of the pixel
in question: */
p = (Uint8 *) (((Uint8 *)surface->pixels) + /* Start at top of RAM */
(y * surface->pitch) + /* Go down Y lines */
(x * 4)); /* Go in X pixels */
p = (Uint8 *) (((Uint8 *) surface->pixels) + /* Start at top of RAM */
(y * surface->pitch) + /* Go down Y lines */
(x * 4)); /* Go in X pixels */
/* Return the correctly-sized piece of data containing the
* pixel's value (an 8-bit palette value, or a 16-, 24- or 32-bit
* RGB value) */
return *(Uint32 *)p; // 32-bit display
return *(Uint32 *) p; // 32-bit display
}
void (*putpixels[])(SDL_Surface *, int, int, Uint32) = {
putpixel8, putpixel8, putpixel16, putpixel24, putpixel32 };
void (*putpixels[]) (SDL_Surface *, int, int, Uint32) =
{
putpixel8, putpixel8, putpixel16, putpixel24, putpixel32};
Uint32 (*getpixels[])(SDL_Surface *, int, int) = {
getpixel8, getpixel8, getpixel16, getpixel24, getpixel32 };
Uint32(*getpixels[])(SDL_Surface *, int, int) =
{
getpixel8, getpixel8, getpixel16, getpixel24, getpixel32};