ecere/gfx/FewFonts/DrawManager;FontManager: Fixed allocator mixups
authorJerome St-Louis <jerome@ecere.com>
Tue, 24 Nov 2015 07:26:07 +0000 (02:26 -0500)
committerJerome St-Louis <jerome@ecere.com>
Wed, 2 Nov 2016 16:32:39 +0000 (12:32 -0400)
ecere/src/gfx/newFonts/drawManager.ec
ecere/src/gfx/newFonts/fontManager.ec

index 67d847b..5759a45 100644 (file)
@@ -714,8 +714,8 @@ public:
      if( imageBufferCount >= imageBufferSize )
      {
        imageBufferSize <<= 1;
-       this.imageBuffer = realloc( this.imageBuffer, imageBufferSize * sizeof(DMImageBuffer) );
-       imageBufferTmp = realloc( imageBufferTmp, imageBufferSize * sizeof(DMImageBuffer) );
+       this.imageBuffer = renew this.imageBuffer DMImageBuffer[imageBufferSize];
+       imageBufferTmp = renew imageBufferTmp DMImageBuffer[imageBufferSize];
      }
 
      imageBuffer = &this.imageBuffer[ imageBufferCount ];
index c5a771b..ee30248 100644 (file)
@@ -8,7 +8,6 @@ import "File"
 
 import "atlasBuilder"
 
-#include <stdlib.h>
 #include <math.h>
 
 #include "cc.h"
@@ -139,7 +138,7 @@ static void blurScale( byte *dst, int width, int height, int stride, int radius,
       if( scale > ( 1 << SPREC ) )
          scale = 1 << SPREC;
 
-      buffer = malloc( width * height * sizeof(int) );
+      buffer = new int[ width * height ];
       for( y = 0 ; y < height ; y++ )
       {
          dstrow = &dst[y*stride];
@@ -166,7 +165,7 @@ static void blurScale( byte *dst, int width, int height, int stride, int radius,
          for( x = 0 ; x < width ; x++ )
             dstrow[x] = (byte)Min(255, bufferrow[x] >> ZPREC);
       }
-      free( buffer );
+      delete buffer;
    }
 }
 
@@ -1526,7 +1525,7 @@ public:
          int i;
 
          // Copy old texture data over.
-         if( !( data = (byte *)malloc( width * height ) ) )
+         if( !( data = new byte[width * height] ) )
             return false;
          for( i = 0 ; i < this.height ; i++ )
          {