From 384d68b679de37c906c8cac250fe2bb407c1ecb3 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Tue, 14 Nov 2017 16:09:21 -0600 Subject: FULLPIPE: Correctly fix Bitmap leaks --- engines/fullpipe/gfx.cpp | 7 +++---- engines/fullpipe/gfx.h | 4 +--- engines/fullpipe/statics.cpp | 6 +++--- 3 files changed, 7 insertions(+), 10 deletions(-) (limited to 'engines') diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index ecc9f8c915..da626c7f1f 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -524,7 +524,7 @@ void Picture::init() { MemoryObject::getData(); - _bitmap = BitmapPtr(new Bitmap()); + _bitmap.reset(new Bitmap()); getDibInfo(); @@ -735,7 +735,7 @@ Bitmap::Bitmap(const Bitmap &src) { _type = src._type; _width = src._width; _height = src._height; - _surface = TransSurfacePtr(src._surface); + _surface = src._surface; _flipping = src._flipping; } @@ -773,8 +773,7 @@ bool Bitmap::isPixelHitAtPos(int x, int y) { } void Bitmap::decode(byte *pixels, const Palette &palette) { - _surface = TransSurfacePtr(new Graphics::TransparentSurface); - + _surface = TransSurfacePtr(new Graphics::TransparentSurface, Graphics::SurfaceDeleter()); _surface->create(_width, _height, Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)); if (_type == MKTAG('R', 'B', '\0', '\0')) diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h index a2f7230c6b..eb8d03fb90 100644 --- a/engines/fullpipe/gfx.h +++ b/engines/fullpipe/gfx.h @@ -81,8 +81,6 @@ private: Bitmap operator=(const Bitmap &); }; -typedef Common::SharedPtr BitmapPtr; - class Picture : public MemoryObject { public: Picture(); @@ -122,7 +120,7 @@ protected: int _field_44; int _width; int _height; - BitmapPtr _bitmap; + Common::ScopedPtr _bitmap; int _field_54; Common::ScopedPtr _memoryObject2; int _alpha; diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index 185a7e5797..8c0a045aa9 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -1425,7 +1425,7 @@ void Statics::init() { Picture::init(); if (_staticsId & 0x4000) { - _bitmap = BitmapPtr(_bitmap->reverseImage()); + _bitmap.reset(_bitmap->reverseImage()); } } @@ -2136,7 +2136,7 @@ DynamicPhase::DynamicPhase(DynamicPhase &src, bool reverse) { if (!src._bitmap) src.init(); - _bitmap = BitmapPtr(src._bitmap->reverseImage()); + _bitmap.reset(src._bitmap->reverseImage()); _dataSize = src._dataSize; if (g_fp->_currArchive) { @@ -2160,7 +2160,7 @@ DynamicPhase::DynamicPhase(DynamicPhase &src, bool reverse) { if (src._bitmap) { _field_54 = 1; - _bitmap = BitmapPtr(src._bitmap->reverseImage(false)); + _bitmap.reset(src._bitmap->reverseImage(false)); } _someX = src._someX; -- cgit v1.2.3