]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix a compile error; don't reallocate if target is same size (not sure if that can...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 31 Jan 2012 08:49:09 +0000 (08:49 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 31 Jan 2012 08:49:09 +0000 (08:49 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11664 d7cf8633-e32d-0410-b094-e92efae38249

gl_textures.c

index 8dc1cae614acd384bfc5e48c9f53fc7a72008f17..742d8b70fd3a286e1700ee9da1f0ace597d015ae 100644 (file)
@@ -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)
                {