[Scummvm-cvs-logs] CVS: scummvm/sword2/driver render.cpp,1.43,1.44

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Sun Dec 7 23:31:01 CET 2003


Update of /cvsroot/scummvm/scummvm/sword2/driver
In directory sc8-pr-cvs1:/tmp/cvs-serv13858/driver

Modified Files:
	render.cpp 
Log Message:
Shut up Valgrind warnings.


Index: render.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/render.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- render.cpp	16 Nov 2003 14:18:29 -0000	1.43
+++ render.cpp	8 Dec 2003 07:30:22 -0000	1.44
@@ -708,15 +708,10 @@
 
 	// Decode the parallax layer into a large chunk of memory
 
-	memchunk = (uint8 *) malloc(_xBlocks[_layer] * BLOCKWIDTH * _yBlocks[_layer] * BLOCKHEIGHT);
+	memchunk = (uint8 *) calloc(_xBlocks[_layer] * _yBlocks[_layer], BLOCKWIDTH * BLOCKHEIGHT);
 	if (!memchunk)
 		return RDERR_OUTOFMEMORY;
 
-	// We clear not the entire memory chunk, but enough of it to store
-	// the entire parallax layer.
-
-	memset(memchunk, 0, p->w * p->h);
-
 	for (i = 0; i < p->h; i++) {
 		if (p->offset[i] == 0)
 			continue;
@@ -762,6 +757,10 @@
 		bool block_is_transparent = false;
 
 		data = memchunk + (p->w * BLOCKHEIGHT * (i / _xBlocks[_layer])) + BLOCKWIDTH * (i % _xBlocks[_layer]);
+
+		// FIXME: The 'block_is_transparent' flag should only consider
+		// data that is inside the parallax layer. Still, it won't do
+		// any harm to leave it this way...
 
 		for (j = 0; j < BLOCKHEIGHT; j++) {
 			for (k = 0; k < BLOCKWIDTH; k++) {





More information about the Scummvm-git-logs mailing list