Converted the instance of osgNew and osgDelete back to new and delete as part

of depecating the include/osg/MemoryManager
This commit is contained in:
Robert Osfield
2002-12-16 13:40:58 +00:00
parent de9b0b336a
commit 00cc3a1833
186 changed files with 812 additions and 809 deletions

View File

@@ -37,7 +37,7 @@ FTBitmapGlyph::FTBitmapGlyph( FT_Glyph glyph)
destWidth = srcWidth;
destHeight = srcHeight;
data = osgNew unsigned char[srcPitch * destHeight];
data = new unsigned char[srcPitch * destHeight];
// !!!! THIS assumes a positive Pitch value. No allowance for negative pitch
for(int y = 0; y < srcHeight; ++y)
@@ -59,7 +59,7 @@ FTBitmapGlyph::FTBitmapGlyph( FT_Glyph glyph)
FTBitmapGlyph::~FTBitmapGlyph()
{
osgDelete [] data;
delete [] data;
}

View File

@@ -18,7 +18,7 @@ FTFace::FTFace():
FTFace::~FTFace()
{
osgDelete charMap;
delete charMap;
charMap = 0;
Close();
}
@@ -26,18 +26,18 @@ FTFace::~FTFace()
bool FTFace::Open( const char* filename)
{
ftFace = osgNew FT_Face;
ftFace = new FT_Face;
err = FT_New_Face( *FTLibrary::Instance().GetLibrary(), filename, 0, ftFace);
if( err)
{
osgDelete ftFace;
delete ftFace;
ftFace = 0;
return false;
}
else
{
charMap = osgNew FTCharmap( *ftFace);
charMap = new FTCharmap( *ftFace);
return true;
}
}
@@ -48,7 +48,7 @@ void FTFace::Close()
if( ftFace)
{
FT_Done_Face( *ftFace);
osgDelete ftFace;
delete ftFace;
ftFace = 0;
}
}

View File

@@ -49,7 +49,7 @@ void FTFont::Close()
{
GlyphContextContainer::iterator itr;
for(itr=_contextGlyphList.begin();itr!=_contextGlyphList.end();itr++)
osgDelete *itr;
delete *itr;
_contextGlyphList.clear();
}
@@ -65,9 +65,9 @@ bool FTFont::FaceSize( const unsigned int size, const unsigned int res , unsigne
FTGlyphContainer*& glyphList=_contextGlyphList[renderContext];
if( glyphList)
osgDelete glyphList;
delete glyphList;
glyphList = osgNew FTGlyphContainer( &face, numGlyphs);
glyphList = new FTGlyphContainer( &face, numGlyphs);
if( MakeGlyphList(renderContext))
{

View File

@@ -25,7 +25,7 @@ bool FTGLBitmapFont::MakeGlyphList(unsigned int renderContext)
if( ftGlyph)
{
FTBitmapGlyph* tempGlyph = osgNew FTBitmapGlyph( *ftGlyph);
FTBitmapGlyph* tempGlyph = new FTBitmapGlyph( *ftGlyph);
glyphList->Add( tempGlyph);
}
else

View File

@@ -23,7 +23,7 @@ bool FTGLOutlineFont::MakeGlyphList( unsigned int renderContext)
if( ftGlyph)
{
FTOutlineGlyph* tempGlyph = osgNew FTOutlineGlyph( *ftGlyph);
FTOutlineGlyph* tempGlyph = new FTOutlineGlyph( *ftGlyph);
glyphList->Add( tempGlyph);
}
else

View File

@@ -25,7 +25,7 @@ bool FTGLPixmapFont::MakeGlyphList(unsigned int renderContext)
if( ftGlyph)
{
FTPixmapGlyph* tempGlyph = osgNew FTPixmapGlyph( *ftGlyph);
FTPixmapGlyph* tempGlyph = new FTPixmapGlyph( *ftGlyph);
glyphList->Add( tempGlyph);
}
else

View File

@@ -24,7 +24,7 @@ bool FTGLPolygonFont::MakeGlyphList( unsigned int renderContext)
if( ftGlyph)
{
FTPolyGlyph* tempGlyph = osgNew FTPolyGlyph( *ftGlyph);
FTPolyGlyph* tempGlyph = new FTPolyGlyph( *ftGlyph);
glyphList->Add( tempGlyph);
}
else

View File

@@ -53,7 +53,7 @@ FTGLTextureFont::~FTGLTextureFont()
if (*itr)
{
glDeleteTextures( numTextures, (const GLuint*)*itr);
osgDelete [] *itr;
delete [] *itr;
}
}
}
@@ -73,7 +73,7 @@ bool FTGLTextureFont::MakeGlyphList(unsigned int renderContext)
return true;
else
{
glTextureID= osgNew unsigned long[16];
glTextureID= new unsigned long[16];
memset(glTextureID,0,sizeof(unsigned long)*16);
glContextTextureID[renderContext]=glTextureID;
}
@@ -98,7 +98,7 @@ bool FTGLTextureFont::MakeGlyphList(unsigned int renderContext)
glGenTextures( numTextures, (GLuint*)&glTextureID[0]);
textMem = osgNew unsigned char[totalMem]; // GL_ALPHA texture;
textMem = new unsigned char[totalMem]; // GL_ALPHA texture;
memset( textMem, 0, totalMem);
unsigned int glyphNum = 0;
@@ -125,14 +125,14 @@ bool FTGLTextureFont::MakeGlyphList(unsigned int renderContext)
glGenTextures( numTextures, (GLuint*)&glTextureID[0]);
textMem = osgNew unsigned char[totalMem]; // GL_ALPHA texture;
textMem = new unsigned char[totalMem]; // GL_ALPHA texture;
memset( textMem, 0, totalMem);
FillGlyphs( 0, glTextureID[0], textureWidth, textureHeight, textMem,renderContext);
CreateTexture( glTextureID[0], textureWidth, textureHeight, textMem);
}
osgDelete [] textMem;
delete [] textMem;
return !err;
}
@@ -159,7 +159,7 @@ unsigned int FTGLTextureFont::FillGlyphs( unsigned int glyphStart, GLuint id, GL
currTextU = (float)currentTextX / (float)width;
FTTextureGlyph* tempGlyph = osgNew FTTextureGlyph( *ftGlyph, id, data, width, height, currTextU, currTextV);
FTTextureGlyph* tempGlyph = new FTTextureGlyph( *ftGlyph, id, data, width, height, currTextU, currTextV);
glyphList->Add( tempGlyph);
currentTextX += glyphWidth;

View File

@@ -19,7 +19,7 @@ FTGlyphContainer::~FTGlyphContainer()
vector<FTGlyph*>::iterator iter;
for( iter = glyphs.begin(); iter != glyphs.end(); ++iter)
{
osgDelete *iter;
delete *iter;
}
glyphs.clear();

View File

@@ -14,7 +14,7 @@ FTLibrary::~FTLibrary()
{
FT_Done_FreeType( *lib);
osgDelete lib;
delete lib;
lib= 0;
}
@@ -22,7 +22,7 @@ FTLibrary::~FTLibrary()
// {
// FTC_Manager_Done( manager );
//
// osgDelete manager;
// delete manager;
// manager= 0;
// }
}
@@ -41,12 +41,12 @@ bool FTLibrary::Init()
if( lib != 0 )
return true;
lib = osgNew FT_Library;
lib = new FT_Library;
err = FT_Init_FreeType( lib);
if( err)
{
osgDelete lib;
delete lib;
lib = 0;
return false;
}
@@ -55,7 +55,7 @@ bool FTLibrary::Init()
//
// if( FTC_Manager_New( lib, 0, 0, 0, my_face_requester, 0, manager )
// {
// osgDelete manager;
// delete manager;
// manager= 0;
// return false;
// }

View File

@@ -21,7 +21,7 @@ FTOutlineGlyph::FTOutlineGlyph( FT_Glyph glyph)
advance = glyph->advance.x >> 16;
vectoriser = osgNew FTVectoriser( glyph);
vectoriser = new FTVectoriser( glyph);
vectoriser->Process();
numContours = vectoriser->contours();
@@ -32,7 +32,7 @@ FTOutlineGlyph::FTOutlineGlyph( FT_Glyph glyph)
return;
}
contourLength = osgNew int[ numContours];
contourLength = new int[ numContours];
memset(contourLength,0,sizeof(int)*numContours);
for( int cn = 0; cn < numContours; ++cn)
{
@@ -40,7 +40,7 @@ FTOutlineGlyph::FTOutlineGlyph( FT_Glyph glyph)
}
numPoints = vectoriser->points();
data = osgNew double[ numPoints * 3];
data = new double[ numPoints * 3];
for( int cp = 0; cp < numPoints * 3; ++cp)
{
data[cp]=0.0;
@@ -80,8 +80,8 @@ FTOutlineGlyph::FTOutlineGlyph( FT_Glyph glyph)
FTOutlineGlyph::~FTOutlineGlyph()
{
osgDelete [] data;
osgDelete [] contourLength;
delete [] data;
delete [] contourLength;
}

View File

@@ -41,7 +41,7 @@ FTPixmapGlyph::FTPixmapGlyph( FT_Glyph glyph)
destWidth = srcWidth;
destHeight = srcHeight;
data = osgNew unsigned char[destWidth * destHeight * 4];
data = new unsigned char[destWidth * destHeight * 4];
// Get the current glColor.
float ftglColour[4] = { 1.0, 1.0, 1.0, 1.0 };
@@ -71,7 +71,7 @@ FTPixmapGlyph::FTPixmapGlyph( FT_Glyph glyph)
FTPixmapGlyph::~FTPixmapGlyph()
{
osgDelete [] data;
delete [] data;
}

View File

@@ -41,7 +41,7 @@ static CreatedVertices s_createdVertices;
void CALLBACK ftglCombine( GLdouble coords[3], void* /*vertex_data*/[4], GLfloat /*weight*/[4], void** outData)
{
double* vertex = osgNew double[3]; // FIXME MEM LEAK
double* vertex = new double[3]; // FIXME MEM LEAK
s_createdVertices.push_back(vertex);
@@ -71,14 +71,14 @@ FTPolyGlyph::FTPolyGlyph( FT_Glyph glyph)
advance = glyph->advance.x >> 16;
vectoriser = osgNew FTVectoriser( glyph);
vectoriser = new FTVectoriser( glyph);
vectoriser->Process();
numContours = vectoriser->contours();
if (numContours==0) return;
contourLength = osgNew int[ numContours];
contourLength = new int[ numContours];
memset(contourLength,0,sizeof(int)*numContours);
for( int c = 0; c < numContours; ++c)
@@ -87,7 +87,7 @@ FTPolyGlyph::FTPolyGlyph( FT_Glyph glyph)
}
numPoints = vectoriser->points();
data = osgNew double[ numPoints * 3];
data = new double[ numPoints * 3];
// initalize memory.
for( int pc=0;pc<numPoints*3;++pc) data[pc]=0.0;
@@ -159,7 +159,7 @@ void FTPolyGlyph::Tesselate()
itr!=s_createdVertices.end();
++itr)
{
osgDelete [] (*itr);
delete [] (*itr);
}
s_createdVertices.clear();
}
@@ -167,8 +167,8 @@ void FTPolyGlyph::Tesselate()
FTPolyGlyph::~FTPolyGlyph()
{
osgDelete [] data;
osgDelete [] contourLength;
delete [] data;
delete [] contourLength;
}

View File

@@ -55,7 +55,7 @@ FTVectoriser::~FTVectoriser()
{
for( int c = 0; c < contours(); ++c)
{
osgDelete contourList[c];
delete contourList[c];
}
contourList.clear();
@@ -82,7 +82,7 @@ bool FTVectoriser::Process()
for( short c = 0; c < cont; ++c)
{
contour = osgNew FTContour;
contour = new FTContour;
contourFlag = ftOutline.flags;
last = ftOutline.contours[c];

View File

@@ -193,7 +193,7 @@ void Font::clear()
if(_font)
{
osgDelete _font;
delete _font;
_font=NULL;
}
@@ -257,7 +257,7 @@ RasterFont()
FTFont* BitmapFont::
createFontObj(void)
{
return (FTFont*)(osgNew FTGLBitmapFont);
return (FTFont*)(new FTGLBitmapFont);
}
// BitmapFont
@@ -281,7 +281,7 @@ RasterFont(font)
FTFont* PixmapFont::
createFontObj(void)
{
return (FTFont*)(osgNew FTGLPixmapFont);
return (FTFont*)(new FTGLPixmapFont);
}
// PixmapFont
@@ -321,7 +321,7 @@ RasterFont(font)
FTFont* TextureFont::
createFontObj(void)
{
return (FTFont*)(osgNew FTGLTextureFont(_textureSize));
return (FTFont*)(new FTGLTextureFont(_textureSize));
}
// TextureFont
@@ -347,7 +347,7 @@ VectorFont(font)
FTFont* OutlineFont::
createFontObj(void)
{
return (FTFont*)(osgNew FTGLOutlineFont);
return (FTFont*)(new FTGLOutlineFont);
}
// _FTGLOutlineFont
@@ -385,7 +385,7 @@ VectorFont(std::string(font))
FTFont* PolygonFont::
createFontObj(void)
{
return (FTFont*)(osgNew FTGLPolygonFont);
return (FTFont*)(new FTGLPolygonFont);
}

View File

@@ -119,7 +119,7 @@ void Paragraph::createDrawables()
++itr)
{
osgText::Text* textDrawable = osgNew osgText::Text(_font.get());
osgText::Text* textDrawable = new osgText::Text(_font.get());
textDrawable->setAlignment(_alignment);
textDrawable->setPosition(pos);
textDrawable->setText(*itr);