mirror of
https://github.com/love2d/love.git
synced 2026-08-19 20:19:42 +02:00
Hopefully fixed more memory leakage in fonts
This commit is contained in:
@@ -45,7 +45,7 @@ namespace font
|
|||||||
|
|
||||||
GlyphData::~GlyphData()
|
GlyphData::~GlyphData()
|
||||||
{
|
{
|
||||||
delete data;
|
delete[] data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void * GlyphData::getData() const
|
void * GlyphData::getData() const
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace opengl
|
|||||||
: height(data->getHeight()), lineHeight(1.25), mSpacing(1)
|
: height(data->getHeight()), lineHeight(1.25), mSpacing(1)
|
||||||
{
|
{
|
||||||
glyphs = new Glyph*[MAX_CHARS];
|
glyphs = new Glyph*[MAX_CHARS];
|
||||||
|
|
||||||
for(unsigned int i = 0; i < MAX_CHARS; i++)
|
for(unsigned int i = 0; i < MAX_CHARS; i++)
|
||||||
{
|
{
|
||||||
glyphs[i] = new Glyph(data->getGlyphData(i));
|
glyphs[i] = new Glyph(data->getGlyphData(i));
|
||||||
@@ -48,6 +48,10 @@ namespace opengl
|
|||||||
|
|
||||||
Font::~Font()
|
Font::~Font()
|
||||||
{
|
{
|
||||||
|
for(unsigned int i = 0; i < MAX_CHARS; i++)
|
||||||
|
{
|
||||||
|
delete glyphs[i];
|
||||||
|
}
|
||||||
delete[] glyphs;
|
delete[] glyphs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,20 +170,20 @@ namespace opengl
|
|||||||
{
|
{
|
||||||
return mSpacing;
|
return mSpacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Font::loadVolatile()
|
bool Font::loadVolatile()
|
||||||
{
|
{
|
||||||
// reload all glyphs
|
// reload all glyphs
|
||||||
for(unsigned int i = 0; i < MAX_CHARS; i++)
|
for(unsigned int i = 0; i < MAX_CHARS; i++)
|
||||||
{
|
{
|
||||||
glyphs[i]->load();
|
glyphs[i]->load();
|
||||||
glNewList(list + i, GL_COMPILE);
|
glNewList(list + i, GL_COMPILE);
|
||||||
glyphs[i]->draw(0, 0, 0, 1, 1, 0, 0);
|
glyphs[i]->draw(0, 0, 0, 1, 1, 0, 0);
|
||||||
glEndList();
|
glEndList();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Font::unloadVolatile()
|
void Font::unloadVolatile()
|
||||||
{
|
{
|
||||||
// delete the glyphs
|
// delete the glyphs
|
||||||
|
|||||||
Reference in New Issue
Block a user