From cec60073b4236f885b1b88c4c5defd3475085069 Mon Sep 17 00:00:00 2001 From: divverent Date: Tue, 31 Jan 2012 08:49:09 +0000 Subject: [PATCH] fix a compile error; don't reallocate if target is same size (not sure if that can ever happen though) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11664 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_textures.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gl_textures.c b/gl_textures.c index 8dc1cae6..742d8b70 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -2702,8 +2702,14 @@ rtexture_t *R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filen { upload_mipwidth = (glt->tilewidth >> mip); upload_mipheight = (glt->tileheight >> mip); - upload_mippixels = Mem_Alloc(tempmempool, 4 * upload_mipwidth * upload_mipheight); - Image_Resample32(mippixels, mipwidth, mipheight, 1, upload_mippixels, upload_mipwidth, upload_mipheight, 1, r_lerpimages.integer); + if(upload_mipwidth != mipwidth || upload_mipheight != mipheight) + // I _think_ they always mismatch, but I was too lazy + // to properly check, and this test here is really + // harmless + { + upload_mippixels = (unsigned char *) Mem_Alloc(tempmempool, 4 * upload_mipwidth * upload_mipheight); + Image_Resample32(mippixels, mipwidth, mipheight, 1, upload_mippixels, upload_mipwidth, upload_mipheight, 1, r_lerpimages.integer); + } } switch(vid.renderpath) { -- 2.39.2