[Scummvm-cvs-logs] SF.net SVN: scummvm: [28475] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Mon Aug 6 22:07:58 CEST 2007


Revision: 28475
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28475&view=rev
Author:   peres001
Date:     2007-08-06 13:07:57 -0700 (Mon, 06 Aug 2007)

Log Message:
-----------
Made disk code directly create background Surface from resources.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/disk_ns.cpp
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/graphics.h

Modified: scummvm/trunk/engines/parallaction/disk_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk_ns.cpp	2007-08-06 19:43:33 UTC (rev 28474)
+++ scummvm/trunk/engines/parallaction/disk_ns.cpp	2007-08-06 20:07:57 UTC (rev 28475)
@@ -589,20 +589,21 @@
 
 	parseBackground(_resArchive);
 
-	byte *bg = (byte*)calloc(1, _vm->_screenSize);
+	Graphics::Surface *bg = new Graphics::Surface;
+	bg->create(_vm->_screenWidth, _vm->_screenHeight, 1);
+
 	BitBuffer *mask = new BitBuffer;
 	mask->create(_vm->_screenWidth, _vm->_screenHeight);
 	byte *path = (byte*)calloc(1, _vm->_screenPathSize);
 
 
 	Graphics::PackBitsReadStream stream(_resArchive);
-	unpackBackground(&stream, bg, mask->data, path);
+	unpackBackground(&stream, (byte*)bg->pixels, mask->data, path);
 
 	_vm->_gfx->setBackground(bg);
 	_vm->_gfx->setMask(mask);
 	_vm->setPath(path);
 
-	free(bg);
 	free(path);
 
 	return;
@@ -1191,17 +1192,17 @@
 
 	Common::SeekableReadStream *s = openArchivedFile(name, true);
 
-	Graphics::Surface surf;
+	Graphics::Surface *surf = new Graphics::Surface;
 	byte *pal;
-	BackgroundDecoder decoder(*s, surf, pal, _vm->_gfx->_palettefx);
+	BackgroundDecoder decoder(*s, *surf, pal, _vm->_gfx->_palettefx);
 	decoder.decode();
 
 	for (uint32 i = 0; i < BASE_PALETTE_COLORS * 3; i++)
 		_vm->_gfx->_palette[i] = pal[i] >> 2;
 	free(pal);
 	_vm->_gfx->setPalette(_vm->_gfx->_palette);
-	_vm->_gfx->setBackground(static_cast<byte*>(surf.pixels));
-	surf.free();
+	_vm->_gfx->setBackground(surf);
+
 	delete s;
 
 	return;

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2007-08-06 19:43:33 UTC (rev 28474)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2007-08-06 20:07:57 UTC (rev 28475)
@@ -752,9 +752,12 @@
 
 
 
-void Gfx::setBackground(byte *background) {
-	memcpy(_buffers[kBitBack]->pixels, background, _vm->_screenSize);
-	copyScreen(kBitBack, kBit2);
+void Gfx::setBackground(Graphics::Surface *surface) {
+	if (_buffers[kBit2])
+		delete _buffers[kBit2];
+
+	_buffers[kBit2] = surface;
+	copyScreen(kBit2, kBitBack);
 }
 
 void Gfx::setMask(BitBuffer *buffer) {
@@ -847,9 +850,9 @@
 	_buffers[kBitFront]->create(_vm->_screenWidth, _vm->_screenHeight, 1);
 	_buffers[kBitBack] = new Graphics::Surface;
 	_buffers[kBitBack]->create(_vm->_screenWidth, _vm->_screenHeight, 1);
-	_buffers[kBit2] = new Graphics::Surface;
-	_buffers[kBit2]->create(_vm->_screenWidth, _vm->_screenHeight, 1);
 
+	_buffers[kBit2] = 0;
+
 	_depthMask = 0;
 
 	setBlackPalette();
@@ -878,9 +881,10 @@
 	delete _buffers[kBitFront];
 	_buffers[kBitBack]->free();
 	delete _buffers[kBitBack];
-	_buffers[kBit2]->free();
-	delete _buffers[kBit2];
 
+	if (_buffers[kBit2])
+		delete _buffers[kBit2];
+
 	delete _fonts[kFontDialogue];
 	delete _fonts[kFontLabel];
 	delete _fonts[kFontMenu];

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2007-08-06 19:43:33 UTC (rev 28474)
+++ scummvm/trunk/engines/parallaction/graphics.h	2007-08-06 20:07:57 UTC (rev 28475)
@@ -219,7 +219,7 @@
 	void restoreDoorBackground(StaticCnv *cnv, const Common::Rect& r, byte* background);
 
 	// location
-	void setBackground(byte *background);
+	void setBackground(Graphics::Surface *surf);
 	void setMask(BitBuffer *buffer);
 	int16 queryMask(int16 v);
 	void intGrottaHackMask();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list