mirror of
https://github.com/yquake2/ref_vk.git
synced 2024-11-10 06:41:45 +00:00
Add const to scale functions
This commit is contained in:
parent
a62603b3c7
commit
d7a11c33be
4 changed files with 14 additions and 16 deletions
|
@ -64,11 +64,11 @@ extern void LoadPCX(char *origname, byte **pic, byte **palette, int *width, int
|
|||
extern void GetPCXInfo(char *filename, int *width, int *height);
|
||||
|
||||
extern qboolean LoadSTB(const char *origname, const char* type, byte **pic, int *width, int *height);
|
||||
extern qboolean ResizeSTB(byte *input_pixels, int input_width, int input_height,
|
||||
extern qboolean ResizeSTB(const byte *input_pixels, int input_width, int input_height,
|
||||
byte *output_pixels, int output_width, int output_height);
|
||||
extern void SmoothColorImage(unsigned *dst, size_t size, size_t rstep);
|
||||
extern void scale2x(byte *src, byte *dst, int width, int height);
|
||||
extern void scale3x(byte *src, byte *dst, int width, int height);
|
||||
extern void scale2x(const byte *src, byte *dst, int width, int height);
|
||||
extern void scale3x(const byte *src, byte *dst, int width, int height);
|
||||
|
||||
extern void GetWalInfo(char *name, int *width, int *height);
|
||||
extern void GetM8Info(char *name, int *width, int *height);
|
||||
|
|
|
@ -96,7 +96,7 @@ LoadSTB(const char *origname, const char* type, byte **pic, int *width, int *hei
|
|||
}
|
||||
|
||||
qboolean
|
||||
ResizeSTB(byte *input_pixels, int input_width, int input_height,
|
||||
ResizeSTB(const byte *input_pixels, int input_width, int input_height,
|
||||
byte *output_pixels, int output_width, int output_height)
|
||||
{
|
||||
if (stbir_resize_uint8(input_pixels, input_width, input_height, 0,
|
||||
|
@ -223,7 +223,7 @@ SmoothColorImage(unsigned *dst, size_t size, size_t rstep)
|
|||
/* https://en.wikipedia.org/wiki/Pixel-art_scaling_algorithms */
|
||||
|
||||
void
|
||||
scale2x(byte *src, byte *dst, int width, int height)
|
||||
scale2x(const byte *src, byte *dst, int width, int height)
|
||||
{
|
||||
/*
|
||||
EPX/Scale2×/AdvMAME2×
|
||||
|
@ -239,7 +239,7 @@ scale2x(byte *src, byte *dst, int width, int height)
|
|||
IF B==D AND B!=A AND D!=C => 4=D
|
||||
*/
|
||||
{
|
||||
byte *in_buff = src;
|
||||
const byte *in_buff = src;
|
||||
byte *out_buff = dst;
|
||||
byte *out_buff_full = dst + ((width * height) << 2);
|
||||
while (out_buff < out_buff_full)
|
||||
|
@ -304,7 +304,7 @@ scale2x(byte *src, byte *dst, int width, int height)
|
|||
}
|
||||
|
||||
void
|
||||
scale3x(byte *src, byte *dst, int width, int height)
|
||||
scale3x(const byte *src, byte *dst, int width, int height)
|
||||
{
|
||||
/*
|
||||
Scale3×/AdvMAME3× and ScaleFX
|
||||
|
@ -326,7 +326,7 @@ scale3x(byte *src, byte *dst, int width, int height)
|
|||
IF F==H AND F!=B AND H!=D => 9=F
|
||||
*/
|
||||
{
|
||||
byte *in_buff = src;
|
||||
const byte *in_buff = src;
|
||||
byte *out_buff = dst;
|
||||
byte *out_buff_full = dst + ((width * height) * 9);
|
||||
while (out_buff < out_buff_full)
|
||||
|
|
|
@ -237,8 +237,7 @@ qboolean RE_EndWorldRenderpass( void );
|
|||
|
||||
struct image_s *RE_RegisterSkin (char *name);
|
||||
|
||||
void LoadPCX (char *filename, byte **pic, byte **palette, int *width, int *height);
|
||||
image_t *Vk_LoadPic(char *name, byte *pic, int width, int realwidth,
|
||||
image_t *Vk_LoadPic(const char *name, byte *pic, int width, int realwidth,
|
||||
int height, int realheight, imagetype_t type,
|
||||
int bits);
|
||||
image_t *Vk_FindImage (char *name, imagetype_t type);
|
||||
|
|
|
@ -1091,7 +1091,7 @@ This is also used as an entry point for the generated r_notexture
|
|||
================
|
||||
*/
|
||||
image_t *
|
||||
Vk_LoadPic(char *name, byte *pic, int width, int realwidth,
|
||||
Vk_LoadPic(const char *name, byte *pic, int width, int realwidth,
|
||||
int height, int realheight, imagetype_t type,
|
||||
int bits)
|
||||
{
|
||||
|
@ -1450,16 +1450,15 @@ image_t *Vk_FindImage (char *name, imagetype_t type)
|
|||
}
|
||||
|
||||
len = strlen(name);
|
||||
|
||||
/* Remove the extension */
|
||||
memset(namewe, 0, 256);
|
||||
memcpy(namewe, name, len - (strlen(ext) + 1));
|
||||
|
||||
if (len < 5)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Remove the extension */
|
||||
memset(namewe, 0, 256);
|
||||
memcpy(namewe, name, len - (strlen(ext) + 1));
|
||||
|
||||
/* fix backslashes */
|
||||
while ((ptr = strchr(name, '\\')))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue