sharkbanana found an edge case.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4766 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2014-10-11 22:53:26 +00:00
parent 3284a25b59
commit e572332173

View file

@ -3571,18 +3571,23 @@ static qboolean Image_GenMip0(struct pendingtextureinfo *mips, unsigned int flag
} }
if (rgbadata)
{
Image_RoundDimensions(&mips->mip[0].width, &mips->mip[0].height, flags); Image_RoundDimensions(&mips->mip[0].width, &mips->mip[0].height, flags);
if (mips->mip[0].width == imgwidth && mips->mip[0].height == imgheight) if (mips->mip[0].width == imgwidth && mips->mip[0].height == imgheight)
mips->mip[0].data = rgbadata; mips->mip[0].data = rgbadata;
else else
{ {
mips->mip[0].data = BZ_Malloc(((mips->mip[0].width+3)&~3)*mips->mip[0].height*4); mips->mip[0].data = BZ_Malloc(((mips->mip[0].width+3)&~3)*mips->mip[0].height*4);
// memset(mips->mip[0].data, 0, mips->mip[0].width*mips->mip[0].height*4); // memset(mips->mip[0].data, 0, mips->mip[0].width*mips->mip[0].height*4);
Image_ResampleTexture(rgbadata, imgwidth, imgheight, mips->mip[0].data, mips->mip[0].width, mips->mip[0].height); Image_ResampleTexture(rgbadata, imgwidth, imgheight, mips->mip[0].data, mips->mip[0].width, mips->mip[0].height);
if (freedata) if (freedata)
BZ_Free(rgbadata); BZ_Free(rgbadata);
freedata = true; freedata = true;
} }
}
else
mips->mip[0].data = NULL;
mips->mip[0].datasize = mips->mip[0].width*mips->mip[0].height*4; mips->mip[0].datasize = mips->mip[0].width*mips->mip[0].height*4;
if (mips->type == PTI_3D) if (mips->type == PTI_3D)