[Scummvm-cvs-logs] scummvm master -> 75d78c71cc2190ae4afa655d27cdbc35a748f901

bluegr bluegr at gmail.com
Wed Dec 24 22:19:29 CET 2014


This automated email contains information about 7 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
16e208318c ZVISION: Plug a memory leak
de2c9ed5bf ZVISION: Disable unused code
1bc9b13357 ZVISION: Introduce pixel formats for resources (555) and screen (565)
84341a889c ZVISION: Let the cursor manager do pixel format conversion for cursors
e8e21fabe4 ZVISION: Set all the internal graphics operations to use RGB555 (1/2)
5f8418394b ZVISION: Set all the internal graphics operations to use RGB555 (2/2)
75d78c71cc ZVISION: Plug another memory leak. Some cleanup


Commit: 16e208318cf75dbe290060663119d1c533f4dd7b
    https://github.com/scummvm/scummvm/commit/16e208318cf75dbe290060663119d1c533f4dd7b
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-12-24T22:56:54+02:00

Commit Message:
ZVISION: Plug a memory leak

Changed paths:
    engines/zvision/scripting/sidefx/animation_node.cpp



diff --git a/engines/zvision/scripting/sidefx/animation_node.cpp b/engines/zvision/scripting/sidefx/animation_node.cpp
index 1f62b61..bf3509f 100644
--- a/engines/zvision/scripting/sidefx/animation_node.cpp
+++ b/engines/zvision/scripting/sidefx/animation_node.cpp
@@ -161,6 +161,7 @@ bool AnimationNode::process(uint32 deltaTimeInMillis) {
 						_engine->getRenderManager()->blitSurfaceToBkg(*transposed, nod->pos.left, nod->pos.top, _mask);
 					else
 						_engine->getRenderManager()->blitSurfaceToBkg(*transposed, nod->pos.left, nod->pos.top);
+					transposed->free();
 					delete transposed;
 				} else {
 					if (_mask > 0)


Commit: de2c9ed5bf9e3d41ad52de8aa0ddf383efa6b24d
    https://github.com/scummvm/scummvm/commit/de2c9ed5bf9e3d41ad52de8aa0ddf383efa6b24d
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-12-24T22:56:54+02:00

Commit Message:
ZVISION: Disable unused code

Changed paths:
    engines/zvision/graphics/render_manager.cpp
    engines/zvision/graphics/render_manager.h



diff --git a/engines/zvision/graphics/render_manager.cpp b/engines/zvision/graphics/render_manager.cpp
index 2f0d2a3..01df824 100644
--- a/engines/zvision/graphics/render_manager.cpp
+++ b/engines/zvision/graphics/render_manager.cpp
@@ -983,9 +983,11 @@ void RenderManager::markDirty() {
 	_backgroundDirtyRect = Common::Rect(_backgroundWidth, _backgroundHeight);
 }
 
+#if 0
 void RenderManager::bkgFill(uint8 r, uint8 g, uint8 b) {
 	_currentBackgroundImage.fillRect(Common::Rect(_currentBackgroundImage.w, _currentBackgroundImage.h), _currentBackgroundImage.format.RGBToColor(r, g, b));
 	markDirty();
 }
+#endif
 
 } // End of namespace ZVision
diff --git a/engines/zvision/graphics/render_manager.h b/engines/zvision/graphics/render_manager.h
index 711c607..c2dc169 100644
--- a/engines/zvision/graphics/render_manager.h
+++ b/engines/zvision/graphics/render_manager.h
@@ -328,8 +328,10 @@ public:
 	// Mark whole background surface as dirty
 	void markDirty();
 
-	// Fille background surface by color
+#if 0
+	// Fill background surface by color
 	void bkgFill(uint8 r, uint8 g, uint8 b);
+#endif
 };
 
 } // End of namespace ZVision


Commit: 1bc9b13357e36f6f52e3dd6f8223ab569e5b5362
    https://github.com/scummvm/scummvm/commit/1bc9b13357e36f6f52e3dd6f8223ab569e5b5362
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-12-24T22:56:55+02:00

Commit Message:
ZVISION: Introduce pixel formats for resources (555) and screen (565)

Changed paths:
    engines/zvision/zvision.cpp
    engines/zvision/zvision.h



diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp
index cf7ed28..145b2eb 100644
--- a/engines/zvision/zvision.cpp
+++ b/engines/zvision/zvision.cpp
@@ -82,6 +82,8 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc)
 	: Engine(syst),
 	  _gameDescription(gameDesc),
 	  _pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), /*RGB 565*/
+	  _resourcePixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0), /* RGB 555 */
+	  _screenPixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), /* RGB 565 */
 	  _desiredFrameTime(33), /* ~30 fps */
 	  _clock(_system),
 	  _scriptManager(nullptr),
@@ -182,17 +184,17 @@ void ZVision::initialize() {
 	} else if (_gameDescription->gameId == GID_NEMESIS)
 		_searchManager->loadZix("NEMESIS.ZIX");
 
-	initGraphics(WINDOW_WIDTH, WINDOW_HEIGHT, true, &_pixelFormat);
+	initGraphics(WINDOW_WIDTH, WINDOW_HEIGHT, true, &_screenPixelFormat);
 
 	// Register random source
 	_rnd = new Common::RandomSource("zvision");
 
 	// Create managers
 	_scriptManager = new ScriptManager(this);
-	_renderManager = new RenderManager(this, WINDOW_WIDTH, WINDOW_HEIGHT, _workingWindow, _pixelFormat);
+	_renderManager = new RenderManager(this, WINDOW_WIDTH, WINDOW_HEIGHT, _workingWindow, _screenPixelFormat);
 	_saveManager = new SaveManager(this);
 	_stringManager = new StringManager(this);
-	_cursorManager = new CursorManager(this, &_pixelFormat);
+	_cursorManager = new CursorManager(this, &_screenPixelFormat);
 	_textRenderer = new TextRenderer(this);
 	_midiManager = new MidiManager();
 
diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h
index 7ea10ed..a63b66f 100644
--- a/engines/zvision/zvision.h
+++ b/engines/zvision/zvision.h
@@ -69,6 +69,8 @@ public:
 	 */
 	Common::Rect _workingWindow;
 	const Graphics::PixelFormat _pixelFormat;
+	const Graphics::PixelFormat _resourcePixelFormat;
+	const Graphics::PixelFormat _screenPixelFormat;
 
 private:
 	enum {


Commit: 84341a889cfafc4c7ecef6cf7d6841df8353fe4b
    https://github.com/scummvm/scummvm/commit/84341a889cfafc4c7ecef6cf7d6841df8353fe4b
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-12-24T22:56:55+02:00

Commit Message:
ZVISION: Let the cursor manager do pixel format conversion for cursors

Changed paths:
    engines/zvision/graphics/cursors/cursor.cpp
    engines/zvision/graphics/cursors/cursor_manager.cpp
    engines/zvision/graphics/cursors/cursor_manager.h
    engines/zvision/zvision.cpp



diff --git a/engines/zvision/graphics/cursors/cursor.cpp b/engines/zvision/graphics/cursors/cursor.cpp
index 515358f..eb25e92 100644
--- a/engines/zvision/graphics/cursors/cursor.cpp
+++ b/engines/zvision/graphics/cursors/cursor.cpp
@@ -57,12 +57,9 @@ ZorkCursor::ZorkCursor(ZVision *engine, const Common::String &fileName)
 	_height = file.readUint16LE();
 
 	uint dataSize = _width * _height * sizeof(uint16);
-	_surface.create(_width, _height, Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0));
+	_surface.create(_width, _height, engine->_resourcePixelFormat);
 	uint32 bytesRead = file.read(_surface.getPixels(), dataSize);
 	assert(bytesRead == dataSize);
-
-	// Convert to RGB 565
-	_surface.convertToInPlace(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
 }
 
 ZorkCursor::ZorkCursor(const ZorkCursor &other) {
diff --git a/engines/zvision/graphics/cursors/cursor_manager.cpp b/engines/zvision/graphics/cursors/cursor_manager.cpp
index 92fd461..a197c7e 100644
--- a/engines/zvision/graphics/cursors/cursor_manager.cpp
+++ b/engines/zvision/graphics/cursors/cursor_manager.cpp
@@ -45,7 +45,7 @@ const char *CursorManager::_zNemCursorFileNames[NUM_CURSORS] = { "00act", "arrow
                                                                  "hright", "hup", "00idle", "left", "right", "ssurr", "stilt", "turn", "up"
                                                                };
 
-CursorManager::CursorManager(ZVision *engine, const Graphics::PixelFormat *pixelFormat)
+CursorManager::CursorManager(ZVision *engine, const Graphics::PixelFormat pixelFormat)
 	: _engine(engine),
 	  _pixelFormat(pixelFormat),
 	  _cursorIsPushed(false),
diff --git a/engines/zvision/graphics/cursors/cursor_manager.h b/engines/zvision/graphics/cursors/cursor_manager.h
index bbfa085..35c605b 100644
--- a/engines/zvision/graphics/cursors/cursor_manager.h
+++ b/engines/zvision/graphics/cursors/cursor_manager.h
@@ -58,7 +58,7 @@ enum CursorIndex {
  */
 class CursorManager {
 public:
-	CursorManager(ZVision *engine, const Graphics::PixelFormat *pixelFormat);
+	CursorManager(ZVision *engine, const Graphics::PixelFormat pixelFormat);
 
 private:
 	static const int NUM_CURSORS = 18;
@@ -67,7 +67,7 @@ private:
 	ZorkCursor _cursors[NUM_CURSORS + 2][2];
 
 	ZVision *_engine;
-	const Graphics::PixelFormat *_pixelFormat;
+	const Graphics::PixelFormat _pixelFormat;
 	bool _cursorIsPushed;
 	int _item;
 	int _lastitem;
diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp
index 145b2eb..5978316 100644
--- a/engines/zvision/zvision.cpp
+++ b/engines/zvision/zvision.cpp
@@ -194,7 +194,7 @@ void ZVision::initialize() {
 	_renderManager = new RenderManager(this, WINDOW_WIDTH, WINDOW_HEIGHT, _workingWindow, _screenPixelFormat);
 	_saveManager = new SaveManager(this);
 	_stringManager = new StringManager(this);
-	_cursorManager = new CursorManager(this, &_screenPixelFormat);
+	_cursorManager = new CursorManager(this, _resourcePixelFormat);
 	_textRenderer = new TextRenderer(this);
 	_midiManager = new MidiManager();
 


Commit: e8e21fabe4dbe4effdfb3df05fd3fae75940f1c5
    https://github.com/scummvm/scummvm/commit/e8e21fabe4dbe4effdfb3df05fd3fae75940f1c5
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-12-24T22:56:55+02:00

Commit Message:
ZVISION: Set all the internal graphics operations to use RGB555 (1/2)

This is the first part of the changes to make the engine use RGB555
internally again. This is done to simplify the rendering pipeline -
the engine will use RGB555 internally, but will output to RGB565.
The overall changes have been broken into two commits, thus this
first commit will break all the game colors

Changed paths:
    engines/zvision/graphics/effect.h
    engines/zvision/graphics/effects/fog.cpp
    engines/zvision/graphics/effects/light.cpp
    engines/zvision/scripting/actions.cpp
    engines/zvision/scripting/controls/input_control.cpp
    engines/zvision/scripting/controls/titler_control.cpp
    engines/zvision/scripting/sidefx/ttytext_node.cpp
    engines/zvision/text/text.cpp
    engines/zvision/text/truetype_font.cpp
    engines/zvision/video/rlf_decoder.cpp
    engines/zvision/video/rlf_decoder.h
    engines/zvision/zvision.cpp



diff --git a/engines/zvision/graphics/effect.h b/engines/zvision/graphics/effect.h
index c6653c6..234cd82 100644
--- a/engines/zvision/graphics/effect.h
+++ b/engines/zvision/graphics/effect.h
@@ -37,7 +37,7 @@ class Effect {
 public:
 
 	Effect(ZVision *engine, uint32 key, Common::Rect region, bool ported) : _engine(engine), _key(key), _region(region), _ported(ported) {
-		_surface.create(_region.width(), _region.height(), _engine->_pixelFormat);
+		_surface.create(_region.width(), _region.height(), _engine->_resourcePixelFormat);
 	}
 	virtual ~Effect() {}
 
diff --git a/engines/zvision/graphics/effects/fog.cpp b/engines/zvision/graphics/effects/fog.cpp
index f59e82a..c28bdde 100644
--- a/engines/zvision/graphics/effects/fog.cpp
+++ b/engines/zvision/graphics/effects/fog.cpp
@@ -79,10 +79,10 @@ const Graphics::Surface *FogFx::draw(const Graphics::Surface &srcSubRect) {
 			if (it->inEffect) {
 				// Not 100% equivalent, but looks nice and not buggy
 				uint8 sr, sg, sb;
-				_engine->_pixelFormat.colorToRGB(lineBuf[i], sr, sg, sb);
+				_engine->_resourcePixelFormat.colorToRGB(lineBuf[i], sr, sg, sb);
 				uint16 fogColor = *(uint16 *)_fog.getBasePtr((i + _pos) % _fog.w, j);
 				uint8 dr, dg, db;
-				_engine->_pixelFormat.colorToRGB(_colorMap[fogColor & 0x1F], dr, dg, db);
+				_engine->_resourcePixelFormat.colorToRGB(_colorMap[fogColor & 0x1F], dr, dg, db);
 				uint16 fr = dr + sr;
 				if (fr > 255)
 					fr = 255;
@@ -92,7 +92,7 @@ const Graphics::Surface *FogFx::draw(const Graphics::Surface &srcSubRect) {
 				uint16 fb = db + sb;
 				if (fb > 255)
 					fb = 255;
-				lineBuf[i] = _engine->_pixelFormat.RGBToColor(fr, fg, fb);
+				lineBuf[i] = _engine->_resourcePixelFormat.RGBToColor(fr, fg, fb);
 			}
 			cnt++;
 			if (cnt >= it->count) {
@@ -138,14 +138,14 @@ void FogFx::update() {
 
 		// Not 100% equivalent, but looks nice and not buggy
 
-		_colorMap[31] = _engine->_pixelFormat.RGBToColor(_r << 3, _g << 3, _b << 3);
+		_colorMap[31] = _engine->_resourcePixelFormat.RGBToColor(_r << 3, _g << 3, _b << 3);
 
 		for (uint8 i = 0; i < 31; i++) {
 			float perc = (float)i / 31.0;
 			uint8 cr = (float)_r * perc;
 			uint8 cg = (float)_g * perc;
 			uint8 cb = (float)_b * perc;
-			_colorMap[i] = _engine->_pixelFormat.RGBToColor(cr << 3, cg << 3, cb << 3);
+			_colorMap[i] = _engine->_resourcePixelFormat.RGBToColor(cr << 3, cg << 3, cb << 3);
 		}
 	}
 
diff --git a/engines/zvision/graphics/effects/light.cpp b/engines/zvision/graphics/effects/light.cpp
index 00b3811..bf65132 100644
--- a/engines/zvision/graphics/effects/light.cpp
+++ b/engines/zvision/graphics/effects/light.cpp
@@ -59,10 +59,10 @@ const Graphics::Surface *LightFx::draw(const Graphics::Surface &srcSubRect) {
 
 	if (_pos < 0) {
 		uint8 cc = ((-_pos) & 0x1F) << 3;
-		dcolor = _engine->_pixelFormat.RGBToColor(cc, cc, cc);
+		dcolor = _engine->_resourcePixelFormat.RGBToColor(cc, cc, cc);
 	} else {
 		uint8 cc = (_pos & 0x1F) << 3;
-		dcolor = _engine->_pixelFormat.RGBToColor(cc, cc, cc);
+		dcolor = _engine->_resourcePixelFormat.RGBToColor(cc, cc, cc);
 	}
 
 	for (uint16 j = 0; j < _surface.h; j++) {
diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp
index 5af847c..1b6e1e2 100644
--- a/engines/zvision/scripting/actions.cpp
+++ b/engines/zvision/scripting/actions.cpp
@@ -580,12 +580,6 @@ ActionPreloadAnimation::ActionPreloadAnimation(ZVision *engine, int32 slotkey, c
 	// The two %*u are usually 0 and dont seem to have a use
 	sscanf(line.c_str(), "%24s %*u %*u %d %d", fileName, &_mask, &_framerate);
 
-	if (_mask > 0) {
-		byte r, g, b;
-		Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0).colorToRGB(_mask, r, g, b);
-		_mask = _engine->_pixelFormat.RGBToColor(r, g, b);
-	}
-
 	_fileName = Common::String(fileName);
 }
 
@@ -648,12 +642,6 @@ ActionPlayAnimation::ActionPlayAnimation(ZVision *engine, int32 slotkey, const C
 	       "%24s %u %u %u %u %u %u %d %*u %*u %d %d",
 	       fileName, &_x, &_y, &_x2, &_y2, &_start, &_end, &_loopCount, &_mask, &_framerate);
 
-	if (_mask > 0) {
-		byte r, g, b;
-		Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0).colorToRGB(_mask, r, g, b);
-		_mask = _engine->_pixelFormat.RGBToColor(r, g, b);
-	}
-
 	_fileName = Common::String(fileName);
 }
 
@@ -861,21 +849,12 @@ ActionSetPartialScreen::ActionSetPartialScreen(ZVision *engine, int32 slotkey, c
 	_y = 0;
 
 	char fileName[25];
-	int color;
 
-	sscanf(line.c_str(), "%u %u %24s %*u %d", &_x, &_y, fileName, &color);
+	sscanf(line.c_str(), "%u %u %24s %*u %d", &_x, &_y, fileName, &_backgroundColor);
 
 	_fileName = Common::String(fileName);
 
-	if (color >= 0) {
-		byte r, g, b;
-		Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0).colorToRGB(color, r, g, b);
-		_backgroundColor = _engine->_pixelFormat.RGBToColor(r, g, b);
-	} else {
-		_backgroundColor = color;
-	}
-
-	if (color > 65535) {
+	if (_backgroundColor > 65535) {
 		warning("Background color for ActionSetPartialScreen is bigger than a uint16");
 	}
 }
diff --git a/engines/zvision/scripting/controls/input_control.cpp b/engines/zvision/scripting/controls/input_control.cpp
index d7734f6..e1e6e6e 100644
--- a/engines/zvision/scripting/controls/input_control.cpp
+++ b/engines/zvision/scripting/controls/input_control.cpp
@@ -199,7 +199,7 @@ bool InputControl::process(uint32 deltaTimeInMillis) {
 		// Blit the text using the RenderManager
 
 		Graphics::Surface txt;
-		txt.create(_textRectangle.width(), _textRectangle.height(), _engine->_pixelFormat);
+		txt.create(_textRectangle.width(), _textRectangle.height(), _engine->_resourcePixelFormat);
 
 		if (!_readOnly || !_focused)
 			_txtWidth = _engine->getTextRenderer()->drawTxt(_currentInputText, _stringInit, txt);
diff --git a/engines/zvision/scripting/controls/titler_control.cpp b/engines/zvision/scripting/controls/titler_control.cpp
index 10ba0af..d6b1d34 100644
--- a/engines/zvision/scripting/controls/titler_control.cpp
+++ b/engines/zvision/scripting/controls/titler_control.cpp
@@ -67,7 +67,7 @@ TitlerControl::TitlerControl(ZVision *engine, uint32 key, Common::SeekableReadSt
 
 	if (!_rectangle.isEmpty()) {
 		_surface = new Graphics::Surface;
-		_surface->create(_rectangle.width(), _rectangle.height(), _engine->_pixelFormat);
+		_surface->create(_rectangle.width(), _rectangle.height(), _engine->_resourcePixelFormat);
 		_surface->fillRect(Common::Rect(_surface->w, _surface->h), 0);
 	}
 }
diff --git a/engines/zvision/scripting/sidefx/ttytext_node.cpp b/engines/zvision/scripting/sidefx/ttytext_node.cpp
index 2930118..66a27e9 100644
--- a/engines/zvision/scripting/sidefx/ttytext_node.cpp
+++ b/engines/zvision/scripting/sidefx/ttytext_node.cpp
@@ -56,7 +56,7 @@ ttyTextNode::ttyTextNode(ZVision *engine, uint32 key, const Common::String &file
 
 		delete infile;
 	}
-	_img.create(_r.width(), _r.height(), _engine->_pixelFormat);
+	_img.create(_r.width(), _r.height(), _engine->_resourcePixelFormat);
 	_style._sharp = true;
 	_style.readAllStyle(_txtbuf);
 	_style.setFont(_fnt);
@@ -158,7 +158,7 @@ void ttyTextNode::newline() {
 }
 
 void ttyTextNode::outchar(uint16 chr) {
-	uint32 clr = _engine->_pixelFormat.RGBToColor(_style._red, _style._green, _style._blue);
+	uint32 clr = _engine->_resourcePixelFormat.RGBToColor(_style._red, _style._green, _style._blue);
 
 	if (_dx + _fnt.getCharWidth(chr) > _r.width())
 		newline();
diff --git a/engines/zvision/text/text.cpp b/engines/zvision/text/text.cpp
index 8ddba3f..f28ba6a 100644
--- a/engines/zvision/text/text.cpp
+++ b/engines/zvision/text/text.cpp
@@ -298,7 +298,7 @@ void cTxtStyle::setFont(StyledTTFont &font) {
 
 Graphics::Surface *TextRenderer::render(StyledTTFont &fnt, const Common::String &txt, cTxtStyle &style) {
 	style.setFontStyle(fnt);
-	uint32 clr = _engine->_pixelFormat.RGBToColor(style._red, style._green, style._blue);
+	uint32 clr = _engine->_resourcePixelFormat.RGBToColor(style._red, style._green, style._blue);
 	return fnt.renderSolidText(txt, clr);
 }
 
@@ -317,7 +317,7 @@ int32 TextRenderer::drawTxt(const Common::String &txt, cTxtStyle &fontStyle, Gra
 
 	dst.fillRect(Common::Rect(dst.w, dst.h), 0);
 
-	uint32 clr = _engine->_pixelFormat.RGBToColor(fontStyle._red, fontStyle._green, fontStyle._blue);
+	uint32 clr = _engine->_resourcePixelFormat.RGBToColor(fontStyle._red, fontStyle._green, fontStyle._blue);
 
 	int16 w;
 
diff --git a/engines/zvision/text/truetype_font.cpp b/engines/zvision/text/truetype_font.cpp
index f373afe..f64c0ab 100644
--- a/engines/zvision/text/truetype_font.cpp
+++ b/engines/zvision/text/truetype_font.cpp
@@ -218,7 +218,7 @@ Graphics::Surface *StyledTTFont::renderSolidText(const Common::String &str, uint
 	if (_font) {
 		int16 w = _font->getStringWidth(str);
 		if (w && w < 1024) {
-			tmp->create(w, _font->getFontHeight(), _engine->_pixelFormat);
+			tmp->create(w, _font->getFontHeight(), _engine->_resourcePixelFormat);
 			drawString(tmp, str, 0, 0, w, color);
 		}
 	}
diff --git a/engines/zvision/video/rlf_decoder.cpp b/engines/zvision/video/rlf_decoder.cpp
index f1ac10b..260f912 100644
--- a/engines/zvision/video/rlf_decoder.cpp
+++ b/engines/zvision/video/rlf_decoder.cpp
@@ -64,7 +64,7 @@ RLFDecoder::RLFVideoTrack::RLFVideoTrack(Common::SeekableReadStream *stream)
 		return;
 	}
 
-	_currentFrameBuffer.create(_width, _height, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
+	_currentFrameBuffer.create(_width, _height, getPixelFormat());
 	_frameBufferByteSize = _width * _height * sizeof(uint16);
 
 	_frames = new Frame[_frameCount];
@@ -239,12 +239,7 @@ void RLFDecoder::RLFVideoTrack::decodeMaskedRunLengthEncoding(int8 *source, int8
 					return;
 				}
 
-				byte r, g, b;
-				// NOTE: Color masks can't be used here, since accurate colors
-				// are required to handle transparency correctly
-				Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0).colorToRGB(READ_LE_UINT16(source + sourceOffset), r, g, b);
-				uint16 destColor = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0).RGBToColor(r, g, b);
-				WRITE_UINT16(dest + destOffset, destColor);
+				WRITE_UINT16(dest + destOffset, READ_LE_UINT16(source + sourceOffset));
 
 				sourceOffset += 2;
 				destOffset += 2;
@@ -288,12 +283,7 @@ void RLFDecoder::RLFVideoTrack::decodeSimpleRunLengthEncoding(int8 *source, int8
 					return;
 				}
 
-				byte r, g, b;
-				// NOTE: Color masks can't be used here, since accurate colors
-				// are required to handle transparency correctly
-				Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0).colorToRGB(READ_LE_UINT16(source + sourceOffset), r, g, b);
-				uint16 destColor = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0).RGBToColor(r, g, b);
-				WRITE_UINT16(dest + destOffset, destColor);
+				WRITE_UINT16(dest + destOffset, READ_LE_UINT16(source + sourceOffset));
 
 				sourceOffset += 2;
 				destOffset += 2;
@@ -307,11 +297,7 @@ void RLFDecoder::RLFVideoTrack::decodeSimpleRunLengthEncoding(int8 *source, int8
 				return;
 			}
 
-			byte r, g, b;
-			// NOTE: Color masks can't be used here, since accurate colors
-			// are required to handle transparency correctly
-			Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0).colorToRGB(READ_LE_UINT16(source + sourceOffset), r, g, b);
-			uint16 sampleColor = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0).RGBToColor(r, g, b);
+			uint16 sampleColor = READ_LE_UINT16(source + sourceOffset);
 			sourceOffset += 2;
 
 			numberOfCopy = numberOfSamples + 2;
diff --git a/engines/zvision/video/rlf_decoder.h b/engines/zvision/video/rlf_decoder.h
index f0f31c2..d56ff2d 100644
--- a/engines/zvision/video/rlf_decoder.h
+++ b/engines/zvision/video/rlf_decoder.h
@@ -45,7 +45,7 @@ private:
 
 		uint16 getWidth() const { return _width; }
 		uint16 getHeight() const { return _height; }
-		Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); /*RGB 565*/ }
+		Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); /* RGB 555 */ }
 		int getCurFrame() const { return _curFrame; }
 		int getFrameCount() const { return _frameCount; }
 		const Graphics::Surface *decodeNextFrame();
diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp
index 5978316..b865ae9 100644
--- a/engines/zvision/zvision.cpp
+++ b/engines/zvision/zvision.cpp
@@ -191,7 +191,7 @@ void ZVision::initialize() {
 
 	// Create managers
 	_scriptManager = new ScriptManager(this);
-	_renderManager = new RenderManager(this, WINDOW_WIDTH, WINDOW_HEIGHT, _workingWindow, _screenPixelFormat);
+	_renderManager = new RenderManager(this, WINDOW_WIDTH, WINDOW_HEIGHT, _workingWindow, _resourcePixelFormat);
 	_saveManager = new SaveManager(this);
 	_stringManager = new StringManager(this);
 	_cursorManager = new CursorManager(this, _resourcePixelFormat);


Commit: 5f8418394b925adfc62ee6d180515157190a8cd9
    https://github.com/scummvm/scummvm/commit/5f8418394b925adfc62ee6d180515157190a8cd9
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-12-24T22:56:56+02:00

Commit Message:
ZVISION: Set all the internal graphics operations to use RGB555 (2/2)

This is the second part of the changes to make the engine use RGB555
internally again. This is done to simplify the rendering pipeline -
the engine will use RGB555 internally, but will output to RGB565.
The overall changes have been broken into two commits, with this
commit finishing all the changes.

This is needed, as the game uses RGB555 graphics internally, but
its AVI animations (full screen and in-game) use RGB565

Changed paths:
    engines/zvision/graphics/cursors/cursor_manager.cpp
    engines/zvision/graphics/render_manager.cpp
    engines/zvision/graphics/render_manager.h
    engines/zvision/video/video.cpp
    engines/zvision/zvision.cpp
    engines/zvision/zvision.h



diff --git a/engines/zvision/graphics/cursors/cursor_manager.cpp b/engines/zvision/graphics/cursors/cursor_manager.cpp
index a197c7e..c364426 100644
--- a/engines/zvision/graphics/cursors/cursor_manager.cpp
+++ b/engines/zvision/graphics/cursors/cursor_manager.cpp
@@ -106,7 +106,7 @@ void CursorManager::initialize() {
 }
 
 void CursorManager::changeCursor(const ZorkCursor &cursor) {
-	CursorMan.replaceCursor(cursor.getSurface(), cursor.getWidth(), cursor.getHeight(), cursor.getHotspotX(), cursor.getHotspotY(), cursor.getKeyColor(), false, _pixelFormat);
+	CursorMan.replaceCursor(cursor.getSurface(), cursor.getWidth(), cursor.getHeight(), cursor.getHotspotX(), cursor.getHotspotY(), cursor.getKeyColor(), false, &_pixelFormat);
 }
 
 void CursorManager::cursorDown(bool pushed) {
diff --git a/engines/zvision/graphics/render_manager.cpp b/engines/zvision/graphics/render_manager.cpp
index 01df824..07ed6d2 100644
--- a/engines/zvision/graphics/render_manager.cpp
+++ b/engines/zvision/graphics/render_manager.cpp
@@ -127,14 +127,29 @@ void RenderManager::renderSceneToScreen() {
 	}
 
 	if (!outWndDirtyRect.isEmpty()) {
-		_system->copyRectToScreen(out->getBasePtr(outWndDirtyRect.left, outWndDirtyRect.top), out->pitch,
-		                          outWndDirtyRect.left + _workingWindow.left,
-		                          outWndDirtyRect.top + _workingWindow.top,
-		                          outWndDirtyRect.width(),
-		                          outWndDirtyRect.height());
+		Common::Rect rect(
+			outWndDirtyRect.left + _workingWindow.left,
+			outWndDirtyRect.top + _workingWindow.top,
+			outWndDirtyRect.left + _workingWindow.left + outWndDirtyRect.width(),
+			outWndDirtyRect.top + _workingWindow.top + outWndDirtyRect.height()
+		);
+		copyToScreen(*out, rect, outWndDirtyRect.left, outWndDirtyRect.top);
 	}
 }
 
+void RenderManager::copyToScreen(const Graphics::Surface &surface, Common::Rect &rect, int16 srcLeft, int16 srcTop) {
+	// Convert the surface to RGB565, if needed
+	Graphics::Surface *outSurface = surface.convertTo(_engine->_screenPixelFormat);
+	_system->copyRectToScreen(outSurface->getBasePtr(srcLeft, srcTop),
+		                        outSurface->pitch,
+		                        rect.left,
+		                        rect.top,
+		                        rect.width(),
+		                        rect.height());
+	outSurface->free();
+	delete outSurface;
+}
+
 void RenderManager::renderImageToBackground(const Common::String &fileName, int16 destX, int16 destY) {
 	Graphics::Surface surface;
 	readImageToSurface(fileName, surface);
@@ -183,8 +198,7 @@ void RenderManager::readImageToSurface(const Common::String &fileName, Graphics:
 	Image::TGADecoder tga;
 	uint16 *buffer;
 	// All ZVision images are in RGB 555
-	Graphics::PixelFormat pixelFormat555 = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0);
-	destination.format = pixelFormat555;
+	destination.format = _engine->_resourcePixelFormat;
 
 	bool isTGZ;
 
@@ -229,7 +243,7 @@ void RenderManager::readImageToSurface(const Common::String &fileName, Graphics:
 	// If the destination internal buffer is the same size as what we're copying into it,
 	// there is no need to free() and re-create
 	if (imageWidth != destination.w || imageHeight != destination.h) {
-		destination.create(imageWidth, imageHeight, pixelFormat555);
+		destination.create(imageWidth, imageHeight, _engine->_resourcePixelFormat);
 	}
 
 	// If transposed, 'un-transpose' the data while copying it to the destination
@@ -245,7 +259,7 @@ void RenderManager::readImageToSurface(const Common::String &fileName, Graphics:
 			}
 		}
 	} else {
-		memcpy(destination.getPixels(), buffer, imageWidth * imageHeight * _pixelFormat.bytesPerPixel);
+		memcpy(destination.getPixels(), buffer, imageWidth * imageHeight * destination.format.bytesPerPixel);
 	}
 
 	// Cleanup
@@ -254,9 +268,6 @@ void RenderManager::readImageToSurface(const Common::String &fileName, Graphics:
 	} else {
 		tga.destroy();
 	}
-
-	// Convert in place to RGB 565 from RGB 555
-	destination.convertToInPlace(_pixelFormat);
 }
 
 const Common::Point RenderManager::screenSpaceToImageSpace(const Common::Point &point) {
@@ -370,10 +381,6 @@ void RenderManager::scaleBuffer(const void *src, void *dst, uint32 srcWidth, uin
 }
 
 void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, const Common::Rect &_srcRect , Graphics::Surface &dst, int _x, int _y) {
-
-	if (src.format != dst.format)
-		return;
-
 	Common::Rect srcRect = _srcRect;
 	if (srcRect.isEmpty())
 		srcRect = Common::Rect(src.w, src.h);
@@ -384,8 +391,10 @@ void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, const Com
 	if (srcRect.isEmpty() || !srcRect.isValidRect())
 		return;
 
+	Graphics::Surface *srcAdapted = src.convertTo(dst.format);
+
 	// Copy srcRect from src surface to dst surface
-	const byte *srcBuffer = (const byte *)src.getBasePtr(srcRect.left, srcRect.top);
+	const byte *srcBuffer = (const byte *)srcAdapted->getBasePtr(srcRect.left, srcRect.top);
 
 	int xx = _x;
 	int yy = _y;
@@ -395,8 +404,11 @@ void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, const Com
 	if (yy < 0)
 		yy = 0;
 
-	if (_x >= dst.w || _y >= dst.h)
+	if (_x >= dst.w || _y >= dst.h) {
+		srcAdapted->free();
+		delete srcAdapted;
 		return;
+	}
 
 	byte *dstBuffer = (byte *)dst.getBasePtr(xx, yy);
 
@@ -404,17 +416,16 @@ void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, const Com
 	int32 h = srcRect.height();
 
 	for (int32 y = 0; y < h; y++) {
-		memcpy(dstBuffer, srcBuffer, w * src.format.bytesPerPixel);
-		srcBuffer += src.pitch;
+		memcpy(dstBuffer, srcBuffer, w * srcAdapted->format.bytesPerPixel);
+		srcBuffer += srcAdapted->pitch;
 		dstBuffer += dst.pitch;
 	}
+
+	srcAdapted->free();
+	delete srcAdapted;
 }
 
 void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, const Common::Rect &_srcRect , Graphics::Surface &dst, int _x, int _y, uint32 colorkey) {
-
-	if (src.format != dst.format)
-		return;
-
 	Common::Rect srcRect = _srcRect;
 	if (srcRect.isEmpty())
 		srcRect = Common::Rect(src.w, src.h);
@@ -425,10 +436,11 @@ void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, const Com
 	if (srcRect.isEmpty() || !srcRect.isValidRect())
 		return;
 
-	uint32 _keycolor = colorkey & ((1 << (src.format.bytesPerPixel << 3)) - 1);
+	Graphics::Surface *srcAdapted = src.convertTo(dst.format);
+	uint32 keycolor = colorkey & ((1 << (src.format.bytesPerPixel << 3)) - 1);
 
 	// Copy srcRect from src surface to dst surface
-	const byte *srcBuffer = (const byte *)src.getBasePtr(srcRect.left, srcRect.top);
+	const byte *srcBuffer = (const byte *)srcAdapted->getBasePtr(srcRect.left, srcRect.top);
 
 	int xx = _x;
 	int yy = _y;
@@ -438,8 +450,11 @@ void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, const Com
 	if (yy < 0)
 		yy = 0;
 
-	if (_x >= dst.w || _y >= dst.h)
+	if (_x >= dst.w || _y >= dst.h) {
+		srcAdapted->free();
+		delete srcAdapted;
 		return;
+	}
 
 	byte *dstBuffer = (byte *)dst.getBasePtr(xx, yy);
 
@@ -447,12 +462,12 @@ void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, const Com
 	int32 h = srcRect.height();
 
 	for (int32 y = 0; y < h; y++) {
-		switch (src.format.bytesPerPixel) {
+		switch (srcAdapted->format.bytesPerPixel) {
 		case 1: {
 			const uint *srcTemp = (const uint *)srcBuffer;
 			uint *dstTemp = (uint *)dstBuffer;
 			for (int32 x = 0; x < w; x++) {
-				if (*srcTemp != _keycolor)
+				if (*srcTemp != keycolor)
 					*dstTemp = *srcTemp;
 				srcTemp++;
 				dstTemp++;
@@ -464,7 +479,7 @@ void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, const Com
 			const uint16 *srcTemp = (const uint16 *)srcBuffer;
 			uint16 *dstTemp = (uint16 *)dstBuffer;
 			for (int32 x = 0; x < w; x++) {
-				if (*srcTemp != _keycolor)
+				if (*srcTemp != keycolor)
 					*dstTemp = *srcTemp;
 				srcTemp++;
 				dstTemp++;
@@ -476,7 +491,7 @@ void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, const Com
 			const uint32 *srcTemp = (const uint32 *)srcBuffer;
 			uint32 *dstTemp = (uint32 *)dstBuffer;
 			for (int32 x = 0; x < w; x++) {
-				if (*srcTemp != _keycolor)
+				if (*srcTemp != keycolor)
 					*dstTemp = *srcTemp;
 				srcTemp++;
 				dstTemp++;
@@ -487,9 +502,12 @@ void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, const Com
 		default:
 			break;
 		}
-		srcBuffer += src.pitch;
+		srcBuffer += srcAdapted->pitch;
 		dstBuffer += dst.pitch;
 	}
+
+	srcAdapted->free();
+	delete srcAdapted;
 }
 
 void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, Graphics::Surface &dst, int x, int y) {
@@ -699,12 +717,15 @@ void RenderManager::clearMenuSurface(const Common::Rect &r) {
 void RenderManager::renderMenuToScreen() {
 	if (!_menuSurfaceDirtyRect.isEmpty()) {
 		_menuSurfaceDirtyRect.clip(Common::Rect(_menuSurface.w, _menuSurface.h));
-		if (!_menuSurfaceDirtyRect.isEmpty())
-			_system->copyRectToScreen(_menuSurface.getBasePtr(_menuSurfaceDirtyRect.left, _menuSurfaceDirtyRect.top), _menuSurface.pitch,
-			                          _menuSurfaceDirtyRect.left + _menuArea.left,
-			                          _menuSurfaceDirtyRect.top + _menuArea.top,
-			                          _menuSurfaceDirtyRect.width(),
-			                          _menuSurfaceDirtyRect.height());
+		if (!_menuSurfaceDirtyRect.isEmpty()) {
+			Common::Rect rect(
+				_menuSurfaceDirtyRect.left + _menuArea.left,
+				_menuSurfaceDirtyRect.top + _menuArea.top,
+				_menuSurfaceDirtyRect.left + _menuArea.left + _menuSurfaceDirtyRect.width(),
+				_menuSurfaceDirtyRect.top + _menuArea.top + _menuSurfaceDirtyRect.height()
+			);
+			copyToScreen(_menuSurface, rect, _menuSurfaceDirtyRect.left, _menuSurfaceDirtyRect.top);
+		}
 		_menuSurfaceDirtyRect = Common::Rect();
 	}
 }
@@ -779,7 +800,7 @@ void RenderManager::processSubs(uint16 deltatime) {
 			OneSubtitle *sub = &it->_value;
 			if (sub->txt.size()) {
 				Graphics::Surface *rndr = new Graphics::Surface();
-				rndr->create(sub->r.width(), sub->r.height(), _pixelFormat);
+				rndr->create(sub->r.width(), sub->r.height(), _engine->_resourcePixelFormat);
 				_engine->getTextRenderer()->drawTxtInOneLine(sub->txt, *rndr);
 				blitSurfaceToSurface(*rndr, _subtitleSurface, sub->r.left - _subtitleArea.left + _workingWindow.left, sub->r.top - _subtitleArea.top + _workingWindow.top);
 				rndr->free();
@@ -788,11 +809,13 @@ void RenderManager::processSubs(uint16 deltatime) {
 			sub->redraw = false;
 		}
 
-		_system->copyRectToScreen(_subtitleSurface.getPixels(), _subtitleSurface.pitch,
-		                          _subtitleArea.left,
-		                          _subtitleArea.top,
-		                          _subtitleSurface.w,
-		                          _subtitleSurface.h);
+		Common::Rect rect(
+			_subtitleArea.left,
+			_subtitleArea.top,
+			_subtitleArea.left + _subtitleSurface.w,
+			_subtitleArea.top + _subtitleSurface.h
+		);
+		copyToScreen(_subtitleSurface, rect, 0, 0);
 	}
 }
 
diff --git a/engines/zvision/graphics/render_manager.h b/engines/zvision/graphics/render_manager.h
index c2dc169..d67ae29 100644
--- a/engines/zvision/graphics/render_manager.h
+++ b/engines/zvision/graphics/render_manager.h
@@ -146,6 +146,8 @@ public:
 	 */
 	void renderSceneToScreen();
 
+	void copyToScreen(const Graphics::Surface &surface, Common::Rect &rect, int16 srcLeft, int16 srcTop);
+
 	/**
 	 * Blits the image or a portion of the image to the background.
 	 *
diff --git a/engines/zvision/video/video.cpp b/engines/zvision/video/video.cpp
index 50a6fc1..e67e657 100644
--- a/engines/zvision/video/video.cpp
+++ b/engines/zvision/video/video.cpp
@@ -114,7 +114,8 @@ void ZVision::playVideo(Video::VideoDecoder &vid, const Common::Rect &destRect,
 					_renderManager->scaleBuffer(frame->getPixels(), scaled->getPixels(), frame->w, frame->h, frame->format.bytesPerPixel, scaled->w, scaled->h);
 					frame = scaled;
 				}
-				_system->copyRectToScreen((const byte *)frame->getPixels(), frame->pitch, x, y, finalWidth, finalHeight);
+				Common::Rect rect = Common::Rect(x, y, x + finalWidth, y + finalHeight);
+				_renderManager->copyToScreen(*frame, rect, 0, 0);
 				_renderManager->processSubs(0);
 			}
 		}
diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp
index b865ae9..db96884 100644
--- a/engines/zvision/zvision.cpp
+++ b/engines/zvision/zvision.cpp
@@ -81,7 +81,6 @@ struct zvisionIniSettings {
 ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc)
 	: Engine(syst),
 	  _gameDescription(gameDesc),
-	  _pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), /*RGB 565*/
 	  _resourcePixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0), /* RGB 555 */
 	  _screenPixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), /* RGB 565 */
 	  _desiredFrameTime(33), /* ~30 fps */
diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h
index a63b66f..e9b8ca4 100644
--- a/engines/zvision/zvision.h
+++ b/engines/zvision/zvision.h
@@ -68,7 +68,6 @@ public:
 	 * edges of this Rectangle
 	 */
 	Common::Rect _workingWindow;
-	const Graphics::PixelFormat _pixelFormat;
 	const Graphics::PixelFormat _resourcePixelFormat;
 	const Graphics::PixelFormat _screenPixelFormat;
 


Commit: 75d78c71cc2190ae4afa655d27cdbc35a748f901
    https://github.com/scummvm/scummvm/commit/75d78c71cc2190ae4afa655d27cdbc35a748f901
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-12-24T23:18:01+02:00

Commit Message:
ZVISION: Plug another memory leak. Some cleanup

Changed paths:
    engines/zvision/scripting/sidefx/animation_node.cpp



diff --git a/engines/zvision/scripting/sidefx/animation_node.cpp b/engines/zvision/scripting/sidefx/animation_node.cpp
index bf3509f..dec70e2 100644
--- a/engines/zvision/scripting/sidefx/animation_node.cpp
+++ b/engines/zvision/scripting/sidefx/animation_node.cpp
@@ -44,7 +44,7 @@ AnimationNode::AnimationNode(ZVision *engine, uint32 controlKey, const Common::S
 		Common::File *tmp = engine->getSearchManager()->openFile(fileName);
 		if (tmp) {
 			tmp->seek(176, SEEK_SET);
-			_frmDelay = tmp->readUint32LE() / 10;
+			_frmDelay = Common::Rational(tmp->readUint32LE(), 10).toInt();
 			delete tmp;
 		}
 
@@ -73,8 +73,10 @@ AnimationNode::~AnimationNode() {
 	if (it != _playList.end()) {
 		_engine->getScriptManager()->setStateValue((*it).slot, 2);
 
-		if ((*it)._scaled)
+		if ((*it)._scaled) {
+			(*it)._scaled->free();
 			delete(*it)._scaled;
+		}
 	}
 
 	_playList.clear();
@@ -109,8 +111,10 @@ bool AnimationNode::process(uint32 deltaTimeInMillis) {
 					if (nod->loop == 0) {
 						if (nod->slot >= 0)
 							_engine->getScriptManager()->setStateValue(nod->slot, 2);
-						if (nod->_scaled)
+						if (nod->_scaled) {
+							nod->_scaled->free();
 							delete nod->_scaled;
+						}
 						_playList.erase(it);
 						return _DisposeAfterUse;
 					}
@@ -142,6 +146,7 @@ bool AnimationNode::process(uint32 deltaTimeInMillis) {
 				if (frame->w > dstw || frame->h > dsth || (frame->w == dstw / 2 && frame->h == dsth / 2)) {
 					if (nod->_scaled)
 						if (nod->_scaled->w != dstw || nod->_scaled->h != dsth) {
+							nod->_scaled->free();
 							delete nod->_scaled;
 							nod->_scaled = NULL;
 						}
@@ -197,8 +202,10 @@ bool AnimationNode::stop() {
 	PlayNodes::iterator it = _playList.begin();
 	if (it != _playList.end()) {
 		_engine->getScriptManager()->setStateValue((*it).slot, 2);
-		if ((*it)._scaled)
+		if ((*it)._scaled) {
+			(*it)._scaled->free();
 			delete(*it)._scaled;
+		}
 	}
 
 	_playList.clear();






More information about the Scummvm-git-logs mailing list