rename s|bitesPerPixel|bitsPerPixel|g

This commit is contained in:
Denis Pauk 2024-07-30 08:49:50 +03:00
parent 40e4eb135a
commit f1d8387d81
5 changed files with 36 additions and 36 deletions

View file

@ -98,19 +98,19 @@ cinematics_t cin;
static void static void
SCR_LoadPCX(char *filename, byte **pic, byte **palette, int *width, int *height, SCR_LoadPCX(char *filename, byte **pic, byte **palette, int *width, int *height,
int *bitesPerPixel) int *bitsPerPixel)
{ {
byte *data, *palette_in; byte *data, *palette_in;
*pic = NULL; *pic = NULL;
*palette = NULL; *palette = NULL;
VID_ImageDecode(filename, &data, &palette_in, width, height, bitesPerPixel); VID_ImageDecode(filename, &data, &palette_in, width, height, bitsPerPixel);
if (data) if (data)
{ {
*pic = Z_Malloc((*width) * (*height) * (*bitesPerPixel) / 8); *pic = Z_Malloc((*width) * (*height) * (*bitsPerPixel) / 8);
memcpy(*pic, data, (*height) * (*width) * (*bitesPerPixel) / 8); memcpy(*pic, data, (*height) * (*width) * (*bitsPerPixel) / 8);
free(data); free(data);
} }
else else
@ -779,7 +779,7 @@ SCR_DrawCinematic(void)
static byte * static byte *
SCR_LoadHiColor(const char* namewe, const char *ext, int *width, int *height, SCR_LoadHiColor(const char* namewe, const char *ext, int *width, int *height,
int *bitesPerPixel) int *bitsPerPixel)
{ {
byte *pic, *data = NULL, *palette = NULL; byte *pic, *data = NULL, *palette = NULL;
char filename[256]; char filename[256];
@ -789,7 +789,7 @@ SCR_LoadHiColor(const char* namewe, const char *ext, int *width, int *height,
Q_strlcat(filename, ext, sizeof(filename)); Q_strlcat(filename, ext, sizeof(filename));
VID_ImageDecode(filename, &data, &palette, VID_ImageDecode(filename, &data, &palette,
width, height, bitesPerPixel); width, height, bitsPerPixel);
if (data == NULL) if (data == NULL)
{ {
return NULL; return NULL;
@ -801,8 +801,8 @@ SCR_LoadHiColor(const char* namewe, const char *ext, int *width, int *height,
free(palette); free(palette);
} }
pic = Z_Malloc(cin.height * cin.width * (*bitesPerPixel) / 8); pic = Z_Malloc(cin.height * cin.width * (*bitsPerPixel) / 8);
memcpy(pic, data, cin.height * cin.width * (*bitesPerPixel) / 8); memcpy(pic, data, cin.height * cin.width * (*bitsPerPixel) / 8);
free(data); free(data);
return pic; return pic;

View file

@ -508,7 +508,7 @@ void V_AddParticle (vec3_t org, unsigned int color, float alpha);
void V_AddLight (vec3_t org, float intensity, float r, float g, float b); void V_AddLight (vec3_t org, float intensity, float r, float g, float b);
void V_AddLightStyle (int style, float r, float g, float b); void V_AddLightStyle (int style, float r, float g, float b);
void VID_ImageDecode(const char *filename, byte **pic, byte **palette, void VID_ImageDecode(const char *filename, byte **pic, byte **palette,
int *width, int *height, int *bitesPerPixel); int *width, int *height, int *bitsPerPixel);
void VID_GetPalette(byte **colormap, unsigned *d_8to24table); void VID_GetPalette(byte **colormap, unsigned *d_8to24table);
void VID_GetPalette24to8(const byte *d_8to24table, byte** d_16to8table); void VID_GetPalette24to8(const byte *d_8to24table, byte** d_16to8table);
unsigned VID_PaletteColor(byte color); unsigned VID_PaletteColor(byte color);

View file

@ -58,7 +58,7 @@ FixFileExt(const char *origname, const char *ext, char *filename, size_t size)
qboolean qboolean
LoadSTB(const char *origname, const char* type, byte **pic, int *width, int *height) LoadSTB(const char *origname, const char* type, byte **pic, int *width, int *height)
{ {
int w, h, bitesPerPixel; int w, h, bitsPerPixel;
char filename[256]; char filename[256];
byte* data = NULL; byte* data = NULL;
@ -66,18 +66,18 @@ LoadSTB(const char *origname, const char* type, byte **pic, int *width, int *hei
*pic = NULL; *pic = NULL;
ri.VID_ImageDecode(filename, &data, NULL, &w, &h, &bitesPerPixel); ri.VID_ImageDecode(filename, &data, NULL, &w, &h, &bitsPerPixel);
if (data == NULL) if (data == NULL)
{ {
return false; return false;
} }
if (bitesPerPixel != 32) if (bitsPerPixel != 32)
{ {
free(data); free(data);
R_Printf(PRINT_ALL, "%s unexpected file format of %s with %d bytes per pixel!\n", R_Printf(PRINT_ALL, "%s unexpected file format of %s with %d bytes per pixel!\n",
__func__, filename, bitesPerPixel); __func__, filename, bitsPerPixel);
return false; return false;
} }
@ -503,13 +503,13 @@ LoadImage_Ext(const char *name, const char* namewe, const char *ext, imagetype_t
int width = 0, height = 0, realwidth = 0, realheight = 0; int width = 0, height = 0, realwidth = 0, realheight = 0;
byte *pic = NULL, *palette = NULL; byte *pic = NULL, *palette = NULL;
char filename[256]; char filename[256];
int bitesPerPixel; int bitsPerPixel;
/* name could not be used here as could have different extension /* name could not be used here as could have different extension
* originaly */ * originaly */
FixFileExt(namewe, ext, filename, sizeof(filename)); FixFileExt(namewe, ext, filename, sizeof(filename));
ri.VID_ImageDecode(filename, &pic, &palette, &width, &height, &bitesPerPixel); ri.VID_ImageDecode(filename, &pic, &palette, &width, &height, &bitsPerPixel);
if (!pic) if (!pic)
{ {
@ -520,13 +520,13 @@ LoadImage_Ext(const char *name, const char* namewe, const char *ext, imagetype_t
realheight = height; realheight = height;
realwidth = width; realwidth = width;
if (bitesPerPixel == 32) if (bitsPerPixel == 32)
{ {
image = load_image(name, pic, image = load_image(name, pic,
width, realwidth, width, realwidth,
height, realheight, height, realheight,
width * height, width * height,
type, bitesPerPixel); type, bitsPerPixel);
} }
else else
{ {
@ -575,7 +575,7 @@ LoadImage_Ext(const char *name, const char* namewe, const char *ext, imagetype_t
image = load_image(name, pic, image = load_image(name, pic,
width, realwidth, width, realwidth,
height, realheight, height, realheight,
width * height, type, bitesPerPixel); width * height, type, bitsPerPixel);
} }
} }

View file

@ -255,7 +255,7 @@ typedef struct
void (IMPORT *Vid_WriteScreenshot)( int width, int height, int comp, const void* data ); void (IMPORT *Vid_WriteScreenshot)( int width, int height, int comp, const void* data );
/* load image from file */ /* load image from file */
void (IMPORT *VID_ImageDecode)( const char *filename, byte **pic, byte **palette, void (IMPORT *VID_ImageDecode)( const char *filename, byte **pic, byte **palette,
int *width, int *height, int *bitesPerPixel); int *width, int *height, int *bitsPerPixel);
void (IMPORT *VID_GetPalette)(byte **colormap, unsigned *d_8to24table); void (IMPORT *VID_GetPalette)(byte **colormap, unsigned *d_8to24table);
void (IMPORT *VID_GetPalette24to8)(const byte *d_8to24table, byte** d_16to8table); void (IMPORT *VID_GetPalette24to8)(const byte *d_8to24table, byte** d_16to8table);

View file

@ -189,7 +189,7 @@ PCX_RLE_Decode(byte *pix, byte *pix_max, const byte *raw, const byte *raw_max,
static void static void
PCX_Decode(const char *name, const byte *raw, int len, byte **pic, byte **palette, PCX_Decode(const char *name, const byte *raw, int len, byte **pic, byte **palette,
int *width, int *height, int *bitesPerPixel) int *width, int *height, int *bitsPerPixel)
{ {
const pcx_t *pcx; const pcx_t *pcx;
int full_size; int full_size;
@ -199,7 +199,7 @@ PCX_Decode(const char *name, const byte *raw, int len, byte **pic, byte **palett
const byte *data; const byte *data;
*pic = NULL; *pic = NULL;
*bitesPerPixel = 8; *bitsPerPixel = 8;
if (palette) if (palette)
{ {
@ -238,7 +238,7 @@ PCX_Decode(const char *name, const byte *raw, int len, byte **pic, byte **palett
if (pcx->color_planes == 3 && pcx->bits_per_pixel == 8) if (pcx->color_planes == 3 && pcx->bits_per_pixel == 8)
{ {
full_size *= 4; full_size *= 4;
*bitesPerPixel = 32; *bitsPerPixel = 32;
} }
out = malloc(full_size); out = malloc(full_size);
@ -772,7 +772,7 @@ Convert24to32(unsigned *d_8to24table, byte *pal)
static void static void
LoadImageWithPalette(const char *filename, byte **pic, byte **palette, LoadImageWithPalette(const char *filename, byte **pic, byte **palette,
int *width, int *height, int *bitesPerPixel) int *width, int *height, int *bitsPerPixel)
{ {
const char* ext; const char* ext;
int len, ident; int len, ident;
@ -798,10 +798,10 @@ LoadImageWithPalette(const char *filename, byte **pic, byte **palette,
ident = LittleShort(*((short*)raw)); ident = LittleShort(*((short*)raw));
if (!strcmp(ext, "pcx") && (ident == PCX_IDENT)) if (!strcmp(ext, "pcx") && (ident == PCX_IDENT))
{ {
PCX_Decode(filename, raw, len, pic, palette, width, height, bitesPerPixel); PCX_Decode(filename, raw, len, pic, palette, width, height, bitsPerPixel);
if(*pic && width && height if(*pic && width && height
&& *width == 319 && *height == 239 && *bitesPerPixel == 8 && *width == 319 && *height == 239 && *bitsPerPixel == 8
&& Q_strcasecmp(filename, "pics/quit.pcx") == 0 && Q_strcasecmp(filename, "pics/quit.pcx") == 0
&& Com_BlockChecksum(raw, len) == 3329419434u) && Com_BlockChecksum(raw, len) == 3329419434u)
{ {
@ -813,21 +813,21 @@ LoadImageWithPalette(const char *filename, byte **pic, byte **palette,
else if (!strcmp(ext, "m8")) else if (!strcmp(ext, "m8"))
{ {
M8_Decode(filename, raw, len, pic, palette, width, height); M8_Decode(filename, raw, len, pic, palette, width, height);
*bitesPerPixel = 8; *bitsPerPixel = 8;
} }
else if (!strcmp(ext, "swl")) else if (!strcmp(ext, "swl"))
{ {
SWL_Decode(filename, raw, len, pic, palette, width, height); SWL_Decode(filename, raw, len, pic, palette, width, height);
*bitesPerPixel = 8; *bitsPerPixel = 8;
} }
else if (!strcmp(ext, "wal")) else if (!strcmp(ext, "wal"))
{ {
WAL_Decode(filename, raw, len, pic, palette, width, height); WAL_Decode(filename, raw, len, pic, palette, width, height);
*bitesPerPixel = 8; *bitsPerPixel = 8;
} }
else else
{ {
int sourcebitesPerPixel = 0; int sourcebitsPerPixel = 0;
/* other formats does not have palette directly */ /* other formats does not have palette directly */
if (palette) if (palette)
@ -842,7 +842,7 @@ LoadImageWithPalette(const char *filename, byte **pic, byte **palette,
else else
{ {
*pic = stbi_load_from_memory(raw, len, width, height, *pic = stbi_load_from_memory(raw, len, width, height,
&sourcebitesPerPixel, STBI_rgb_alpha); &sourcebitsPerPixel, STBI_rgb_alpha);
if (*pic == NULL) if (*pic == NULL)
{ {
@ -851,7 +851,7 @@ LoadImageWithPalette(const char *filename, byte **pic, byte **palette,
} }
} }
*bitesPerPixel = 32; *bitsPerPixel = 32;
} }
FS_FreeFile(raw); FS_FreeFile(raw);
@ -859,9 +859,9 @@ LoadImageWithPalette(const char *filename, byte **pic, byte **palette,
void void
VID_ImageDecode(const char *filename, byte **pic, byte **palette, VID_ImageDecode(const char *filename, byte **pic, byte **palette,
int *width, int *height, int *bitesPerPixel) int *width, int *height, int *bitsPerPixel)
{ {
LoadImageWithPalette(filename, pic, palette, width, height, bitesPerPixel); LoadImageWithPalette(filename, pic, palette, width, height, bitsPerPixel);
if (palette && *palette && colormap_cache && !colormap_loaded) if (palette && *palette && colormap_cache && !colormap_loaded)
{ {
@ -876,14 +876,14 @@ static void
LoadPalette(byte **colormap, unsigned *d_8to24table) LoadPalette(byte **colormap, unsigned *d_8to24table)
{ {
const char * filename; const char * filename;
int bitesPerPixel; int bitsPerPixel;
byte *pal = NULL; byte *pal = NULL;
filename = "pics/colormap.pcx"; filename = "pics/colormap.pcx";
/* get the palette and colormap */ /* get the palette and colormap */
LoadImageWithPalette(filename, colormap, &pal, NULL, NULL, LoadImageWithPalette(filename, colormap, &pal, NULL, NULL,
&bitesPerPixel); &bitsPerPixel);
if (!*colormap || !pal) if (!*colormap || !pal)
{ {
int width = 0, height = 0; int width = 0, height = 0;
@ -891,7 +891,7 @@ LoadPalette(byte **colormap, unsigned *d_8to24table)
filename = "pics/colormap.bmp"; filename = "pics/colormap.bmp";
LoadImageWithPalette(filename, &pic, NULL, &width, &height, &bitesPerPixel); LoadImageWithPalette(filename, &pic, NULL, &width, &height, &bitsPerPixel);
if (pic && width == 256 && height == 320) if (pic && width == 256 && height == 320)
{ {
int i; int i;