]> git.rm.cloudns.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)
committerRudolf Polzer <divverent@xonotic.org>
Tue, 31 Jan 2012 08:52:17 +0000 (09:52 +0100)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11664 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=cec60073b4236f885b1b88c4c5defd3475085069

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)
                {