Replace *_ResampleTexture to ResizeSTB

This commit is contained in:
Denis Pauk 2020-02-06 22:13:45 +02:00
parent ff9f9accd3
commit aaade648b9
2 changed files with 2 additions and 52 deletions

View file

@ -409,53 +409,6 @@ R_FloodFillSkin(byte *skin, int skinwidth, int skinheight)
}
}
void
R_ResampleTexture(unsigned *in, int inwidth, int inheight,
unsigned *out, int outwidth, int outheight)
{
int i, j;
unsigned *inrow, *inrow2;
unsigned frac, fracstep;
unsigned p1[1024], p2[1024];
byte *pix1, *pix2, *pix3, *pix4;
fracstep = inwidth * 0x10000 / outwidth;
frac = fracstep >> 2;
for (i = 0; i < outwidth; i++)
{
p1[i] = 4 * (frac >> 16);
frac += fracstep;
}
frac = 3 * (fracstep >> 2);
for (i = 0; i < outwidth; i++)
{
p2[i] = 4 * (frac >> 16);
frac += fracstep;
}
for (i = 0; i < outheight; i++, out += outwidth)
{
inrow = in + inwidth * (int)((i + 0.25) * inheight / outheight);
inrow2 = in + inwidth * (int)((i + 0.75) * inheight / outheight);
for (j = 0; j < outwidth; j++)
{
pix1 = (byte *)inrow + p1[j];
pix2 = (byte *)inrow + p2[j];
pix3 = (byte *)inrow2 + p1[j];
pix4 = (byte *)inrow2 + p2[j];
((byte *)(out + j))[0] = (pix1[0] + pix2[0] + pix3[0] + pix4[0]) >> 2;
((byte *)(out + j))[1] = (pix1[1] + pix2[1] + pix3[1] + pix4[1]) >> 2;
((byte *)(out + j))[2] = (pix1[2] + pix2[2] + pix3[2] + pix4[2]) >> 2;
((byte *)(out + j))[3] = (pix1[3] + pix2[3] + pix3[3] + pix4[3]) >> 2;
}
}
}
/*
* Scale up the pixel values in a
* texture to increase the
@ -702,8 +655,8 @@ R_Upload32Soft(unsigned *data, int width, int height, qboolean mipmap)
}
else
{
R_ResampleTexture(data, width, height, scaled,
scaled_width, scaled_height);
ResizeSTB((byte *)data, width, height,
(byte *)scaled, scaled_width, scaled_height);
}
R_LightScaleTexture(scaled, scaled_width, scaled_height, !mipmap);

View file

@ -282,9 +282,6 @@ void R_SwapBuffers(int);
int Draw_GetPalette(void);
void R_ResampleTexture(unsigned *in, int inwidth, int inheight,
unsigned *out, int outwidth, int outheight);
image_t *R_LoadPic(char *name, byte *pic, int width, int realwidth,
int height, int realheight, imagetype_t type, int bits);
image_t *R_FindImage(char *name, imagetype_t type);