diff options
Diffstat (limited to 'engines/fullpipe')
-rw-r--r-- | engines/fullpipe/detection.cpp | 2 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.cpp | 8 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.h | 4 | ||||
-rw-r--r-- | engines/fullpipe/gfx.cpp | 25 | ||||
-rw-r--r-- | engines/fullpipe/gfx.h | 6 | ||||
-rw-r--r-- | engines/fullpipe/modal.cpp | 7 | ||||
-rw-r--r-- | engines/fullpipe/scene.cpp | 3 | ||||
-rw-r--r-- | engines/fullpipe/statics.cpp | 2 |
8 files changed, 36 insertions, 21 deletions
diff --git a/engines/fullpipe/detection.cpp b/engines/fullpipe/detection.cpp index 8f4de11e79..e22bcd3d50 100644 --- a/engines/fullpipe/detection.cpp +++ b/engines/fullpipe/detection.cpp @@ -25,6 +25,8 @@ #include "engines/advancedDetector.h" #include "common/file.h" +#include "graphics/surface.h" + #include "fullpipe/fullpipe.h" #include "fullpipe/gameloader.h" diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 10c1744dd9..9c474d111b 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -28,6 +28,7 @@ #include "audio/mixer.h" #include "engines/util.h" +#include "graphics/surface.h" #include "fullpipe/fullpipe.h" #include "fullpipe/gameloader.h" @@ -285,7 +286,8 @@ Common::Error FullpipeEngine::run() { // Initialize backend initGraphics(800, 600, true, &format); - _backgroundSurface.create(800, 600, format); + _backgroundSurface = new Graphics::Surface; + _backgroundSurface->create(800, 600, format); _origFormat = new Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); @@ -502,7 +504,9 @@ void FullpipeEngine::cleanup() { stopAllSoundStreams(); delete _origFormat; - _backgroundSurface.free(); + _backgroundSurface->free(); + + delete _backgroundSurface; } void FullpipeEngine::updateScreen() { diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index b00da629fe..3733bed65d 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -30,8 +30,6 @@ #include "common/savefile.h" #include "common/system.h" -#include "graphics/transparent_surface.h" - #include "engines/engine.h" #include "gui/debugger.h" @@ -123,7 +121,7 @@ public: void updateEvents(); - Graphics::Surface _backgroundSurface; + Graphics::Surface *_backgroundSurface; Graphics::PixelFormat *_origFormat; GameLoader *_gameLoader; diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index 4dec4b640c..619f41d6da 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -30,6 +30,7 @@ #include "fullpipe/gameloader.h" #include "common/memstream.h" +#include "graphics/transparent_surface.h" namespace Fullpipe { @@ -478,7 +479,7 @@ void Picture::freePicture() { if (_bitmap) { if (testFlags() && !_field_54) { freeData(); - //free(_bitmap); + free(_bitmap); _bitmap = 0; } } @@ -677,8 +678,8 @@ void Picture::displayPicture() { if (!_dataSize) return; - g_fp->_backgroundSurface.fillRect(Common::Rect(0, 0, 800, 600), 0); - g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface.getBasePtr(0, 0), g_fp->_backgroundSurface.pitch, 0, 0, 800, 600); + g_fp->_backgroundSurface->fillRect(Common::Rect(0, 0, 800, 600), 0); + g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface->getBasePtr(0, 0), g_fp->_backgroundSurface->pitch, 0, 0, 800, 600); draw(0, 0, 0, 0); @@ -771,6 +772,7 @@ Bitmap::Bitmap() { _flags = 0; _surface = 0; _flipping = Graphics::FLIP_NONE; + _copied_surface = false; } Bitmap::Bitmap(Bitmap *src) { @@ -783,15 +785,16 @@ Bitmap::Bitmap(Bitmap *src) { _height = src->_height; _pixels = src->_pixels; _surface = new Graphics::TransparentSurface(*src->_surface); + _copied_surface = true; _flipping = src->_flipping; } Bitmap::~Bitmap() { - if (_pixels) - free(_pixels); - _surface->free(); + if (!_copied_surface) + _surface->free(); delete _surface; + _surface = 0; _pixels = 0; } @@ -858,8 +861,8 @@ void Bitmap::putDib(int x, int y, int32 *palette, byte alpha) { int alphac = TS_ARGB(0xff, alpha, 0xff, 0xff); - _surface->blit(g_fp->_backgroundSurface, x1, y1, _flipping, &sub, alphac); - g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface.getBasePtr(x1, y1), g_fp->_backgroundSurface.pitch, x1, y1, sub.width(), sub.height()); + _surface->blit(*g_fp->_backgroundSurface, x1, y1, _flipping, &sub, alphac); + g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface->getBasePtr(x1, y1), g_fp->_backgroundSurface->pitch, x1, y1, sub.width(), sub.height()); } bool Bitmap::putDibRB(int32 *palette) { @@ -1255,7 +1258,7 @@ DynamicPhase *Shadows::findSize(int width, int height) { void FullpipeEngine::drawAlphaRectangle(int x1, int y1, int x2, int y2, int alpha) { for (int y = y1; y < y2; y++) { - uint32 *ptr = (uint32 *)g_fp->_backgroundSurface.getBasePtr(x1, y); + uint32 *ptr = (uint32 *)g_fp->_backgroundSurface->getBasePtr(x1, y); for (int x = x1; x < x2; x++) { uint32 color = *ptr; @@ -1274,8 +1277,8 @@ void FullpipeEngine::sceneFade(Scene *sc, bool direction) { int ticks = g_fp->_system->getMillis(); sc->draw(); - drawAlphaRectangle(0, 0, g_fp->_backgroundSurface.w, g_fp->_backgroundSurface.h, direction ? dim : 255 - dim); - g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface.getBasePtr(0, 0), g_fp->_backgroundSurface.pitch, 0, 0, 800, 600); + drawAlphaRectangle(0, 0, g_fp->_backgroundSurface->w, g_fp->_backgroundSurface->h, direction ? dim : 255 - dim); + g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface->getBasePtr(0, 0), g_fp->_backgroundSurface->pitch, 0, 0, 800, 600); g_fp->_system->updateScreen(); ticks = g_fp->_system->getMillis() - ticks; diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h index 566586fb48..43c23b49bc 100644 --- a/engines/fullpipe/gfx.h +++ b/engines/fullpipe/gfx.h @@ -23,6 +23,11 @@ #ifndef FULLPIPE_GFX_H #define FULLPIPE_GFX_H +namespace Graphics { + struct Surface; + struct TransparentSurface; +} + namespace Fullpipe { class DynamicPhase; @@ -40,6 +45,7 @@ struct Bitmap { int _flags; Graphics::TransparentSurface *_surface; int _flipping; + bool _copied_surface; Bitmap(); Bitmap(Bitmap *src); diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 41c1ba368b..3faa035c60 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -33,6 +33,7 @@ #include "fullpipe/objectnames.h" #include "graphics/palette.h" +#include "graphics/surface.h" #include "video/avi_decoder.h" #include "engines/savestate.h" @@ -2397,8 +2398,7 @@ bool ModalDemo::init(int counterDiff) { if (_clickedQuit == -1) return true; - // open URL - // http://www.amazon.de/EuroVideo-Bildprogramm-GmbH-Full-Pipe/dp/B003TO51YE/ref=sr_1_1?ie=UTF8&s=videogames&qid=1279207213&sr=8-1 + g_system->openUrl("http://www.amazon.de/EuroVideo-Bildprogramm-GmbH-Full-Pipe/dp/B003TO51YE/ref=sr_1_1?ie=UTF8&s=videogames&qid=1279207213&sr=8-1"); g_fp->_gameContinue = false; @@ -2407,8 +2407,7 @@ bool ModalDemo::init(int counterDiff) { bool ModalDemo::init2(int counterDiff) { if (_clickedQuit) { - // open URL - // http://pipestudio.ru/fullpipe/ + g_system->openUrl("http://pipestudio.ru/fullpipe/"); g_fp->_gameContinue = false; diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index d560703fa5..4e3678bfb4 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -31,6 +31,7 @@ #include "fullpipe/constants.h" #include "common/algorithm.h" +#include "graphics/surface.h" namespace Fullpipe { @@ -534,7 +535,7 @@ void Scene::draw() { updateScrolling(); // Clean previous stuff - g_fp->_backgroundSurface.fillRect(Common::Rect(0, 0, 800, 600), 0); + g_fp->_backgroundSurface->fillRect(Common::Rect(0, 0, 800, 600), 0); drawContent(60000, 0, true); diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index ece4f43e9f..bc66ebf40b 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -552,6 +552,8 @@ void Movement::draw(bool flipFlag, int angle) { } else { bmp->putDib(x, y, (int32 *)_currDynamicPhase->_paletteData, _currDynamicPhase->_alpha); } + //Prevent memory leak after new was used to create bmp in reverseImage() + delete bmp; if (_currDynamicPhase->_rect->top) { if (!_currDynamicPhase->_convertedBitmap) { |