aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/base/gfx
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-07-30 20:39:04 +0200
committerEinar Johan Trøan Sømåen2012-07-30 20:39:04 +0200
commit6330c1e5fdced523e1e245eac67754cd2b519c32 (patch)
tree9257bd4ef4b891759839f0082be2e9087ae00903 /engines/wintermute/base/gfx
parent18409fe5c03264ca74902e263f80523692f76a77 (diff)
downloadscummvm-rg350-6330c1e5fdced523e1e245eac67754cd2b519c32.tar.gz
scummvm-rg350-6330c1e5fdced523e1e245eac67754cd2b519c32.tar.bz2
scummvm-rg350-6330c1e5fdced523e1e245eac67754cd2b519c32.zip
WINTERMUTE: Fix a few memory-leaks
Diffstat (limited to 'engines/wintermute/base/gfx')
-rw-r--r--engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
index c449f6471c..9f0e605f39 100644
--- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
@@ -139,6 +139,7 @@ bool BaseSurfaceOSystem::finishLoad() {
// convert 32-bit BMPs to 24-bit or they appear totally transparent (does any app actually write alpha in BMP properly?)
// Well, actually, we don't convert via 24-bit as the color-key application overwrites the Alpha-channel anyhow.
+ _surface->free();
delete _surface;
if (_filename.hasSuffix(".bmp") && image->getSurface()->format.bytesPerPixel == 4) {
_surface = image->getSurface()->convertTo(g_system->getScreenFormat(), image->getPalette());
@@ -412,6 +413,7 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, flo
bool BaseSurfaceOSystem::putSurface(const Graphics::Surface &surface, bool hasAlpha) {
_loaded = true;
+ _surface->free();
_surface->copyFrom(surface);
_hasAlpha = hasAlpha;
BaseRenderOSystem *renderer = static_cast<BaseRenderOSystem *>(_gameRef->_renderer);