From 2d2cfbe005b93397f1e121888b0358e137ccc863 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Wed, 11 Feb 2015 15:08:32 -0600 Subject: ZVISION: Create temporary subtitle surfaces on the stack rather than the heap --- engines/zvision/graphics/render_manager.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'engines/zvision') diff --git a/engines/zvision/graphics/render_manager.cpp b/engines/zvision/graphics/render_manager.cpp index 67410b4b6a..3772d5909e 100644 --- a/engines/zvision/graphics/render_manager.cpp +++ b/engines/zvision/graphics/render_manager.cpp @@ -753,13 +753,12 @@ void RenderManager::processSubs(uint16 deltatime) { for (SubtitleMap::iterator it = _subsList.begin(); it != _subsList.end(); it++) { OneSubtitle *sub = &it->_value; if (sub->txt.size()) { - Graphics::Surface *rndr = new Graphics::Surface(); - rndr->create(sub->r.width(), sub->r.height(), _engine->_resourcePixelFormat); - _engine->getTextRenderer()->drawTextWithWordWrapping(sub->txt, *rndr); + Graphics::Surface subtitleSurface; + subtitleSurface.create(sub->r.width(), sub->r.height(), _engine->_resourcePixelFormat); + _engine->getTextRenderer()->drawTextWithWordWrapping(sub->txt, subtitleSurface); Common::Rect empty; - blitSurfaceToSurface(*rndr, empty, _subtitleSurface, sub->r.left - _subtitleArea.left + _workingWindow.left, sub->r.top - _subtitleArea.top + _workingWindow.top); - rndr->free(); - delete rndr; + blitSurfaceToSurface(subtitleSurface, empty, _subtitleSurface, sub->r.left - _subtitleArea.left + _workingWindow.left, sub->r.top - _subtitleArea.top + _workingWindow.top); + subtitleSurface.free(); } sub->redraw = false; } -- cgit v1.2.3