Updated structure and field names for consistency

Type names are camel case and field names are snake case except for fields ending in id, which are capitalized.

Fixes https://github.com/libsdl-org/SDL/issues/6955
This commit is contained in:
Sam Lantinga
2024-02-11 08:03:26 -08:00
parent 6f87973b9c
commit cacac6cc34
74 changed files with 499 additions and 366 deletions

View File

@@ -131,7 +131,7 @@ static int SDL_BlendFillRect_RGB(SDL_Surface *dst, const SDL_Rect *rect,
SDL_PixelFormat *fmt = dst->format;
unsigned inva = 0xff - a;
switch (fmt->BytesPerPixel) {
switch (fmt->bytes_per_pixel) {
case 2:
switch (blendMode) {
case SDL_BLENDMODE_BLEND:
@@ -181,7 +181,7 @@ static int SDL_BlendFillRect_RGBA(SDL_Surface *dst, const SDL_Rect *rect,
SDL_PixelFormat *fmt = dst->format;
unsigned inva = 0xff - a;
switch (fmt->BytesPerPixel) {
switch (fmt->bytes_per_pixel) {
case 4:
switch (blendMode) {
case SDL_BLENDMODE_BLEND:
@@ -216,7 +216,7 @@ int SDL_BlendFillRect(SDL_Surface *dst, const SDL_Rect *rect,
}
/* This function doesn't work on surfaces < 8 bpp */
if (dst->format->BitsPerPixel < 8) {
if (dst->format->bits_per_pixel < 8) {
return SDL_SetError("SDL_BlendFillRect(): Unsupported surface format");
}
@@ -237,7 +237,7 @@ int SDL_BlendFillRect(SDL_Surface *dst, const SDL_Rect *rect,
b = DRAW_MUL(b, a);
}
switch (dst->format->BitsPerPixel) {
switch (dst->format->bits_per_pixel) {
case 15:
switch (dst->format->Rmask) {
case 0x7C00:
@@ -286,7 +286,7 @@ int SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
}
/* This function doesn't work on surfaces < 8 bpp */
if (dst->format->BitsPerPixel < 8) {
if (dst->format->bits_per_pixel < 8) {
return SDL_SetError("SDL_BlendFillRects(): Unsupported surface format");
}
@@ -297,7 +297,7 @@ int SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
}
/* FIXME: Does this function pointer slow things down significantly? */
switch (dst->format->BitsPerPixel) {
switch (dst->format->bits_per_pixel) {
case 15:
switch (dst->format->Rmask) {
case 0x7C00:

View File

@@ -765,7 +765,7 @@ typedef void (*BlendLineFunc)(SDL_Surface *dst,
static BlendLineFunc SDL_CalculateBlendLineFunc(const SDL_PixelFormat *fmt)
{
switch (fmt->BytesPerPixel) {
switch (fmt->bytes_per_pixel) {
case 2:
if (fmt->Rmask == 0x7C00) {
return SDL_BlendLine_RGB555;

View File

@@ -131,7 +131,7 @@ static int SDL_BlendPoint_RGB(SDL_Surface *dst, int x, int y, SDL_BlendMode blen
SDL_PixelFormat *fmt = dst->format;
unsigned inva = 0xff - a;
switch (fmt->BytesPerPixel) {
switch (fmt->bytes_per_pixel) {
case 2:
switch (blendMode) {
case SDL_BLENDMODE_BLEND:
@@ -181,7 +181,7 @@ static int SDL_BlendPoint_RGBA(SDL_Surface *dst, int x, int y, SDL_BlendMode ble
SDL_PixelFormat *fmt = dst->format;
unsigned inva = 0xff - a;
switch (fmt->BytesPerPixel) {
switch (fmt->bytes_per_pixel) {
case 4:
switch (blendMode) {
case SDL_BLENDMODE_BLEND:
@@ -214,7 +214,7 @@ int SDL_BlendPoint(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint
}
/* This function doesn't work on surfaces < 8 bpp */
if (dst->format->BitsPerPixel < 8) {
if (dst->format->bits_per_pixel < 8) {
return SDL_SetError("SDL_BlendPoint(): Unsupported surface format");
}
@@ -231,7 +231,7 @@ int SDL_BlendPoint(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint
b = DRAW_MUL(b, a);
}
switch (dst->format->BitsPerPixel) {
switch (dst->format->bits_per_pixel) {
case 15:
switch (dst->format->Rmask) {
case 0x7C00:
@@ -282,7 +282,7 @@ int SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count,
}
/* This function doesn't work on surfaces < 8 bpp */
if (dst->format->BitsPerPixel < 8) {
if (dst->format->bits_per_pixel < 8) {
return SDL_SetError("SDL_BlendPoints(): Unsupported surface format");
}
@@ -293,7 +293,7 @@ int SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count,
}
/* FIXME: Does this function pointer slow things down significantly? */
switch (dst->format->BitsPerPixel) {
switch (dst->format->bits_per_pixel) {
case 15:
switch (dst->format->Rmask) {
case 0x7C00:

View File

@@ -364,7 +364,7 @@
#define HLINE(type, op, draw_end) \
{ \
int length; \
int pitch = (dst->pitch / dst->format->BytesPerPixel); \
int pitch = (dst->pitch / dst->format->bytes_per_pixel); \
type *pixel; \
if (x1 <= x2) { \
pixel = (type *)dst->pixels + y1 * pitch + x1; \
@@ -386,7 +386,7 @@
#define VLINE(type, op, draw_end) \
{ \
int length; \
int pitch = (dst->pitch / dst->format->BytesPerPixel); \
int pitch = (dst->pitch / dst->format->bytes_per_pixel); \
type *pixel; \
if (y1 <= y2) { \
pixel = (type *)dst->pixels + y1 * pitch + x1; \
@@ -408,7 +408,7 @@
#define DLINE(type, op, draw_end) \
{ \
int length; \
int pitch = (dst->pitch / dst->format->BytesPerPixel); \
int pitch = (dst->pitch / dst->format->bytes_per_pixel); \
type *pixel; \
if (y1 <= y2) { \
pixel = (type *)dst->pixels + y1 * pitch + x1; \
@@ -628,7 +628,7 @@
do { \
int width = rect->w; \
int height = rect->h; \
int pitch = (dst->pitch / dst->format->BytesPerPixel); \
int pitch = (dst->pitch / dst->format->bytes_per_pixel); \
int skip = pitch - width; \
type *pixel = (type *)dst->pixels + rect->y * pitch + rect->x; \
while (height--) { \

View File

@@ -31,7 +31,7 @@ static void SDL_DrawLine1(SDL_Surface *dst, int x1, int y1, int x2, int y2, Uint
{
if (y1 == y2) {
int length;
int pitch = (dst->pitch / dst->format->BytesPerPixel);
int pitch = (dst->pitch / dst->format->bytes_per_pixel);
Uint8 *pixel;
if (x1 <= x2) {
pixel = (Uint8 *)dst->pixels + y1 * pitch + x1;
@@ -119,9 +119,9 @@ typedef void (*DrawLineFunc)(SDL_Surface *dst,
static DrawLineFunc SDL_CalculateDrawLineFunc(const SDL_PixelFormat *fmt)
{
switch (fmt->BytesPerPixel) {
switch (fmt->bytes_per_pixel) {
case 1:
if (fmt->BitsPerPixel < 8) {
if (fmt->bits_per_pixel < 8) {
break;
}
return SDL_DrawLine1;

View File

@@ -32,7 +32,7 @@ int SDL_DrawPoint(SDL_Surface *dst, int x, int y, Uint32 color)
}
/* This function doesn't work on surfaces < 8 bpp */
if (dst->format->BitsPerPixel < 8) {
if (dst->format->bits_per_pixel < 8) {
return SDL_SetError("SDL_DrawPoint(): Unsupported surface format");
}
@@ -43,7 +43,7 @@ int SDL_DrawPoint(SDL_Surface *dst, int x, int y, Uint32 color)
return 0;
}
switch (dst->format->BytesPerPixel) {
switch (dst->format->bytes_per_pixel) {
case 1:
DRAW_FASTSETPIXELXY1(x, y);
break;
@@ -72,7 +72,7 @@ int SDL_DrawPoints(SDL_Surface *dst, const SDL_Point *points, int count,
}
/* This function doesn't work on surfaces < 8 bpp */
if (dst->format->BitsPerPixel < 8) {
if (dst->format->bits_per_pixel < 8) {
return SDL_SetError("SDL_DrawPoints(): Unsupported surface format");
}
@@ -89,7 +89,7 @@ int SDL_DrawPoints(SDL_Surface *dst, const SDL_Point *points, int count,
continue;
}
switch (dst->format->BytesPerPixel) {
switch (dst->format->bytes_per_pixel) {
case 1:
DRAW_FASTSETPIXELXY1(x, y);
break;

View File

@@ -143,8 +143,8 @@ static int SW_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
src = (Uint8 *)pixels;
dst = (Uint8 *)surface->pixels +
rect->y * surface->pitch +
rect->x * surface->format->BytesPerPixel;
length = (size_t)rect->w * surface->format->BytesPerPixel;
rect->x * surface->format->bytes_per_pixel;
length = (size_t)rect->w * surface->format->bytes_per_pixel;
for (row = 0; row < rect->h; ++row) {
SDL_memcpy(dst, src, length);
src += pitch;
@@ -163,7 +163,7 @@ static int SW_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
*pixels =
(void *)((Uint8 *)surface->pixels + rect->y * surface->pitch +
rect->x * surface->format->BytesPerPixel);
rect->x * surface->format->bytes_per_pixel);
*pitch = surface->pitch;
return 0;
}
@@ -363,7 +363,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
SDL_GetSurfaceColorMod(src, &rMod, &gMod, &bMod);
/* SDLgfx_rotateSurface only accepts 32-bit surfaces with a 8888 layout. Everything else has to be converted. */
if (src->format->BitsPerPixel != 32 || SDL_PIXELLAYOUT(src->format->format) != SDL_PACKEDLAYOUT_8888 || !src->format->Amask) {
if (src->format->bits_per_pixel != 32 || SDL_PIXELLAYOUT(src->format->format) != SDL_PACKEDLAYOUT_8888 || !src->format->Amask) {
blitRequired = SDL_TRUE;
}
@@ -486,7 +486,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
* to be created. This makes all source pixels opaque and the colors get copied correctly.
*/
SDL_Surface *src_rotated_rgb;
int f = SDL_GetPixelFormatEnumForMasks(src_rotated->format->BitsPerPixel,
int f = SDL_GetPixelFormatEnumForMasks(src_rotated->format->bits_per_pixel,
src_rotated->format->Rmask,
src_rotated->format->Gmask,
src_rotated->format->Bmask,
@@ -995,7 +995,7 @@ static SDL_Surface *SW_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *
pixels = (void *)((Uint8 *)surface->pixels +
rect->y * surface->pitch +
rect->x * surface->format->BytesPerPixel);
rect->x * surface->format->bytes_per_pixel);
return SDL_DuplicatePixels(rect->w, rect->h, surface->format->format, SDL_COLORSPACE_SRGB, pixels, surface->pitch);
}

View File

@@ -508,8 +508,8 @@ SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, in
}
}
/* This function requires a 32-bit surface or 8-bit surface with a colorkey */
is8bit = src->format->BitsPerPixel == 8 && colorKeyAvailable;
if (!(is8bit || (src->format->BitsPerPixel == 32 && src->format->Amask))) {
is8bit = src->format->bits_per_pixel == 8 && colorKeyAvailable;
if (!(is8bit || (src->format->bits_per_pixel == 32 && src->format->Amask))) {
return NULL;
}

View File

@@ -299,13 +299,13 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin
SDL_SetSurfaceBlendMode(tmp, blend);
dstbpp = tmp->format->BytesPerPixel;
dstbpp = tmp->format->bytes_per_pixel;
dst_ptr = tmp->pixels;
dst_pitch = tmp->pitch;
} else {
/* Write directly to destination surface */
dstbpp = dst->format->BytesPerPixel;
dstbpp = dst->format->bytes_per_pixel;
dst_ptr = (Uint8 *)dst->pixels + dstrect.x * dstbpp + dstrect.y * dst->pitch;
dst_pitch = dst->pitch;
}
@@ -578,7 +578,7 @@ int SDL_SW_BlitTriangle(
}
/* Set destination pointer */
dstbpp = dst->format->BytesPerPixel;
dstbpp = dst->format->bytes_per_pixel;
dst_ptr = (Uint8 *)dst->pixels + dstrect.x * dstbpp + dstrect.y * dst->pitch;
dst_pitch = dst->pitch;
@@ -794,8 +794,8 @@ static void SDL_BlitTriangle_Slow(SDL_BlitInfo *info,
Uint32 dstR, dstG, dstB, dstA;
SDL_PixelFormat *src_fmt = info->src_fmt;
SDL_PixelFormat *dst_fmt = info->dst_fmt;
int srcbpp = src_fmt->BytesPerPixel;
int dstbpp = dst_fmt->BytesPerPixel;
int srcbpp = src_fmt->bytes_per_pixel;
int dstbpp = dst_fmt->bytes_per_pixel;
int srcfmt_val;
int dstfmt_val;
Uint32 rgbmask = ~src_fmt->Amask;