All pastes #756370 Raw Edit

Stuff

public text v1 · immutable
#756370 ·published 2007-10-31 13:13 UTC
rendered paste body
--- VTexture.cpp.orig	2007-10-31 14:35:54.000000000 +0200
+++ VTexture.cpp	2007-10-31 15:09:57.669463524 +0200
@@ -44,12 +44,7 @@
     pTexture->Tag = "";
     pTexture->isAlpha = bAlpha;
 
-#ifdef ENABLE_SDLGFX
-    pTexture->pcData = pcData;
-#endif
-
 #ifdef ENABLE_OPENGL
-    pTexture->pcData = NULL;
     pTexture->nID = 0;
 
     /* OpenGL magic */
@@ -113,8 +108,8 @@
     if (retval!=0) {
         throw TextureError("Failed to scale image in TextureManagerc::createTexture()");
     }
-//	delete[] pcData;
-	pcData = (unsigned char*) newdata;
+	delete[] pcData;
+	pcData = newdata;
 
 	nWidth = max_texture_size;
 	nHeight = max_texture_size;
@@ -174,8 +169,12 @@
         pTexture->surface  = SDL_CreateRGBSurfaceFrom(pcData,nWidth,nHeight,24 /*bitsPerPixel */, nWidth * 3 /*pitch*/,rmask,gmask,bmask,0);
 
       }
+
+      pTexture->pcData = pc;
 #else
   pTexture->surface = NULL;
+  pTexture->pcData = NULL;
+  delete pcData;
 #endif
   
     /* Do it captain */
@@ -267,9 +266,6 @@
       }
       
       pTexture = createTexture(TexName,pc,TextureImage.getWidth(),TextureImage.getHeight(),bAlpha,bClamp, eFilterMode);
-#ifdef ENABLE_OPENGL
-      delete pc;
-#endif
     }
     else {
       Logger::Log("** Warning ** : TextureManager::loadTexture() : texture '%s' not found or invalid",Path.c_str());