GRAPHICS: Delete MacFont in MacText

This commit is contained in:
Tobia Tesan 2017-04-30 00:18:23 +02:00 committed by Eugene Sandulenko
parent af664fe757
commit ed2f09b13f
3 changed files with 6 additions and 2 deletions

View file

@ -847,7 +847,6 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
} }
Graphics::MacFont *macFont = new Graphics::MacFont(textCast->fontId, textCast->fontSize, textCast->textSlant); Graphics::MacFont *macFont = new Graphics::MacFont(textCast->fontId, textCast->fontSize, textCast->textSlant);
// TODO: MacText must destroy me
debugC(3, kDebugText, "renderText: x: %d y: %d w: %d h: %d font: '%s'", x, y, width, height, _vm->_wm->_fontMan->getFontName(*macFont)); debugC(3, kDebugText, "renderText: x: %d y: %d w: %d h: %d font: '%s'", x, y, width, height, _vm->_wm->_fontMan->getFontName(*macFont));

View file

@ -37,6 +37,11 @@ const Font *MacFontRun::getFont() {
return font; return font;
} }
MacText::~MacText(){
delete _macFont;
}
MacText::MacText(Common::String s, MacWindowManager *wm, const MacFont *macFont, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment) { MacText::MacText(Common::String s, MacWindowManager *wm, const MacFont *macFont, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment) {
_str = s; _str = s;
_wm = wm; _wm = wm;

View file

@ -90,7 +90,7 @@ class MacText {
public: public:
MacText(Common::String s, MacWindowManager *wm, const MacFont *font, int fgcolor, int bgcolor, MacText(Common::String s, MacWindowManager *wm, const MacFont *font, int fgcolor, int bgcolor,
int maxWidth = -1, TextAlign textAlignment = kTextAlignLeft); int maxWidth = -1, TextAlign textAlignment = kTextAlignLeft);
~MacText();
void setInterLinear(int interLinear); void setInterLinear(int interLinear);
void draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff); void draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff);