Fixed various uninitiliazed variables.

This commit is contained in:
Robert Osfield
2002-07-21 20:34:38 +00:00
parent 3cda894ca5
commit bfefb55a9f
11 changed files with 55 additions and 14 deletions

View File

@@ -22,6 +22,8 @@ FTBitmapGlyph::FTBitmapGlyph( FT_Glyph glyph)
int srcHeight = source->rows;
int srcPitch = source->pitch;
if (srcPitch*srcHeight==0) return;
advance = glyph->advance.x >> 16;
pos.x = bitmap->left;

View File

@@ -4,13 +4,16 @@
#include "FTGL.h"
FTFace::FTFace()
: charMap(0),
FTFace::FTFace():
charMap(0),
ftFace(0),
numCharMaps(0),
numGlyphs(0),
err(0)
{}
{
kernAdvance.x = 0;
kernAdvance.y = 0;
}
FTFace::~FTFace()

View File

@@ -6,8 +6,9 @@
#include <osg/DisplaySettings>
// mrn@changes
FTFont::FTFont()
: numFaces(0),
FTFont::FTFont():
numFaces(0),
numGlyphs(0),
err(0)
{
_contextGlyphList.resize(osg::DisplaySettings::instance()->getMaxNumberOfGraphicsContexts(),NULL);

View File

@@ -69,7 +69,8 @@ bool FTGLTextureFont::MakeGlyphList(unsigned int renderContext)
return true;
else
{
glTextureID=new unsigned long[16];
glTextureID= osgNew unsigned long[16];
memset(glTextureID,0,sizeof(unsigned long)*16);
glContextTextureID[renderContext]=glTextureID;
}

View File

@@ -22,8 +22,14 @@ FTOutlineGlyph::FTOutlineGlyph( FT_Glyph glyph)
vectoriser->Process();
numContours = vectoriser->contours();
contourLength = osgNew int[ numContours];
if (numContours==0)
{
return;
}
contourLength = osgNew int[ numContours];
memset(contourLength,0,sizeof(int)*numContours);
for( int cn = 0; cn < numContours; ++cn)
{
contourLength[cn] = vectoriser->contourSize( cn);
@@ -31,6 +37,11 @@ FTOutlineGlyph::FTOutlineGlyph( FT_Glyph glyph)
numPoints = vectoriser->points();
data = osgNew double[ numPoints * 3];
for( int cp = 0; cp < numPoints * 3; ++cp)
{
data[cp]=0.0;
}
vectoriser->MakeOutline( data);
advance = glyph->advance.x >> 16;

View File

@@ -26,6 +26,8 @@ FTPixmapGlyph::FTPixmapGlyph( FT_Glyph glyph)
int srcHeight = source->rows;
int srcPitch = source->pitch;
if (srcWidth*srcHeight==0) return;
numGreys = source->num_grays;
advance = glyph->advance.x >> 16;

View File

@@ -58,6 +58,7 @@ FTPolyGlyph::FTPolyGlyph( FT_Glyph glyph)
vectoriser(0),
numPoints(0),
numContours(0),
contourFlag(0),
contourLength(0),
data(0),
glList(0)
@@ -69,7 +70,11 @@ FTPolyGlyph::FTPolyGlyph( FT_Glyph glyph)
vectoriser->Process();
numContours = vectoriser->contours();
if (numContours==0) return;
contourLength = osgNew int[ numContours];
memset(contourLength,0,sizeof(int)*numContours);
for( int c = 0; c < numContours; ++c)
{
@@ -78,6 +83,9 @@ FTPolyGlyph::FTPolyGlyph( FT_Glyph glyph)
numPoints = vectoriser->points();
data = osgNew double[ numPoints * 3];
// initalize memory.
for( int pc=0;pc<numPoints*3;++pc) data[pc]=0.0;
// FIXME MakeMesh
vectoriser->MakeOutline( data);

View File

@@ -4,11 +4,11 @@
FTSize::FTSize()
: ftFace(0),
ftSize(0),
size(0),
err(0)
{}
FTSize::~FTSize()
{}

View File

@@ -4,6 +4,7 @@
FTTextureGlyph::FTTextureGlyph( FT_Glyph glyph, int id, unsigned char* data, GLsizei stride, GLsizei height, float u, float v)
: FTGlyph(),
activeTextureID(0),
destWidth(0),
destHeight(0),
numGreys(0),

View File

@@ -36,9 +36,21 @@ FTVectoriser::FTVectoriser( FT_Glyph glyph)
ftOutline = outline->outline;
contourList.reserve( ftOutline.n_contours);
for(int i=0;i<4;++i)
{
for(int j=0;j<4;++j)
{
bValues[i][j][0]=0.0f;
bValues[i][j][1]=0.0f;
}
ctrlPtArray[i][0]=0.0f;
ctrlPtArray[i][1]=0.0f;
}
}
FTVectoriser::~FTVectoriser()
{
for( int c = 0; c < contours(); ++c)

View File

@@ -60,7 +60,7 @@ bool BitmapFont_readLocalData(osg::Object &obj, osgDB::Input &fr)
if (fr[0].matchWord("parameters")) {
int psize;
if (fr[1].getInt(psize) && fr[2].isInt() && fr[3].isString()) {
osgText::BitmapFont *temp = new osgText::BitmapFont(std::string(fr[3].getStr()), psize);
osgText::BitmapFont *temp = osgNew osgText::BitmapFont(std::string(fr[3].getStr()), psize);
temp->copyAndInvalidate(myobj);
fr += 4;
itAdvanced = true;
@@ -94,7 +94,7 @@ bool PixmapFont_readLocalData(osg::Object &obj, osgDB::Input &fr)
if (fr[0].matchWord("parameters")) {
int psize;
if (fr[1].getInt(psize) && fr[2].isInt() && fr[3].isString()) {
osgText::PixmapFont *temp = new osgText::PixmapFont(std::string(fr[3].getStr()), psize);
osgText::PixmapFont *temp = osgNew osgText::PixmapFont(std::string(fr[3].getStr()), psize);
temp->copyAndInvalidate(myobj);
fr += 4;
itAdvanced = true;
@@ -127,7 +127,7 @@ bool TextureFont_readLocalData(osg::Object &obj, osgDB::Input &fr)
if (fr[0].matchWord("parameters")) {
int psize, txsize;
if (fr[1].getInt(psize) && fr[2].getInt(txsize) && fr[3].isString()) {
osgText::TextureFont *temp = new osgText::TextureFont(std::string(fr[3].getStr()), psize, txsize);
osgText::TextureFont *temp = osgNew osgText::TextureFont(std::string(fr[3].getStr()), psize, txsize);
temp->copyAndInvalidate(myobj);
fr += 4;
itAdvanced = true;
@@ -161,7 +161,7 @@ bool OutlineFont_readLocalData(osg::Object &obj, osgDB::Input &fr)
if (fr[0].matchWord("parameters")) {
int psize;
if (fr[1].getInt(psize) && fr[2].isInt() && fr[3].isString()) {
osgText::OutlineFont *temp = new osgText::OutlineFont(std::string(fr[3].getStr()), psize, 1);
osgText::OutlineFont *temp = osgNew osgText::OutlineFont(std::string(fr[3].getStr()), psize, 1);
temp->copyAndInvalidate(myobj);
fr += 4;
itAdvanced = true;
@@ -194,7 +194,7 @@ bool PolygonFont_readLocalData(osg::Object &obj, osgDB::Input &fr)
if (fr[0].matchWord("parameters")) {
int psize;
if (fr[1].getInt(psize) && fr[2].isInt() && fr[3].isString()) {
osgText::PolygonFont *temp = new osgText::PolygonFont(std::string(fr[3].getStr()), psize, 1);
osgText::PolygonFont *temp = osgNew osgText::PolygonFont(std::string(fr[3].getStr()), psize, 1);
temp->copyAndInvalidate(myobj);
fr += 4;
itAdvanced = true;