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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sat Mar 10 22:23:23 CET 2007


Revision: 26068
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26068&view=rev
Author:   peres001
Date:     2007-03-10 13:23:22 -0800 (Sat, 10 Mar 2007)

Log Message:
-----------
more robust font management

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

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2007-03-10 19:09:20 UTC (rev 26067)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2007-03-10 21:23:22 UTC (rev 26068)
@@ -56,7 +56,6 @@
   0x05, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x06, 0x05, 0x05, 0x05, 0x05
 };
 
-Cnv 		Graphics::_font;
 bool		Graphics::_proportionalFont = false;
 Point		Graphics::_labelPosition[2] = { { 0, 0 }, { 0, 0 } };
 StaticCnv	Graphics::_mouseComposedArrow;
@@ -797,9 +796,7 @@
 
 
 void Graphics::setFont(const char* name) {
-	if (_font._array != NULL)
-		freeCnv(&_font);
-
+	freeCnv(&_font);
 	_vm->_disk->loadFont(name, &_font);
 }
 
@@ -922,11 +919,20 @@
 //	printf("Graphics::freeCnv()\n");
 
 	if (!cnv) return;
+	if (cnv->_count == 0) return;
+	if (!cnv->_array) return;
 
 	for (uint16 _si = 0; _si < cnv->_count; _si++) {
-		free(cnv->_array[_si]);
+		if (cnv->_array[_si]) {
+			free(cnv->_array[_si]);
+		}
+		cnv->_array[_si] = NULL;
 	}
-	if (cnv->_array) free(cnv->_array);
+
+	if (cnv->_array)
+		free(cnv->_array);
+
+	cnv->_count = 0;
 	cnv->_array = NULL;
 
 	return;
@@ -1126,6 +1132,7 @@
 
 	initMouse( 0 );
 
+	_font._count = 0;
 	_font._array = NULL;
 
 	return;

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2007-03-10 19:09:20 UTC (rev 26067)
+++ scummvm/trunk/engines/parallaction/graphics.h	2007-03-10 21:23:22 UTC (rev 26068)
@@ -156,7 +156,7 @@
 	static byte			_mouseArrow[256];
 	static StaticCnv	_mouseComposedArrow;
 
-	static Cnv			_font;
+	Cnv					_font;
 
 
 protected:


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