aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2017-11-14 16:09:21 -0600
committerEugene Sandulenko2017-11-18 22:35:12 +0100
commit384d68b679de37c906c8cac250fe2bb407c1ecb3 (patch)
tree7dd8fd2cc0cf1b12bbbed96731d1d05653376be5
parent7c66ffe5c89594f2d6f072b8e6b5c1f089395a11 (diff)
downloadscummvm-rg350-384d68b679de37c906c8cac250fe2bb407c1ecb3.tar.gz
scummvm-rg350-384d68b679de37c906c8cac250fe2bb407c1ecb3.tar.bz2
scummvm-rg350-384d68b679de37c906c8cac250fe2bb407c1ecb3.zip
FULLPIPE: Correctly fix Bitmap leaks
-rw-r--r--engines/fullpipe/gfx.cpp7
-rw-r--r--engines/fullpipe/gfx.h4
-rw-r--r--engines/fullpipe/statics.cpp6
3 files changed, 7 insertions, 10 deletions
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<Bitmap> BitmapPtr;
-
class Picture : public MemoryObject {
public:
Picture();
@@ -122,7 +120,7 @@ protected:
int _field_44;
int _width;
int _height;
- BitmapPtr _bitmap;
+ Common::ScopedPtr<Bitmap> _bitmap;
int _field_54;
Common::ScopedPtr<MemoryObject2> _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;