[Scummvm-cvs-logs] CVS: scummvm/scumm charset.cpp,2.46,2.47

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Sun Jun 15 08:20:13 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv15896

Modified Files:
	charset.cpp 
Log Message:
Made CharsetRendererNut::printChar() take the shadow into consideration
when calculating the dimensions of a printed message and when deciding
which parts of the screen to dirty.

I imagine this will fix most of the minor text-drawing glitches that have
been plaguing CoMI. Unfortunately, it fixes none of the major ones.


Index: charset.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.cpp,v
retrieving revision 2.46
retrieving revision 2.47
diff -u -d -r2.46 -r2.47
--- charset.cpp	15 Jun 2003 01:42:14 -0000	2.46
+++ charset.cpp	15 Jun 2003 15:19:22 -0000	2.47
@@ -850,15 +850,24 @@
 }
 
 void CharsetRendererNut::printChar(int chr) {
+	int shadow_left, shadow_right, shadow_top, shadow_bottom;
+
 	assert(_current);
 	if (chr == '@')
 		return;
 
+	shadow_left = _left - 1;
+	shadow_top = _top - 1;
+
+	// Note that the character is drawn with a shadow, so it is slightly
+	// larger than the advertised dimensions. See drawShadowChar() for
+	// details.
+
 	if (_firstChar) {
-		_str.left = _left;
-		_str.top = _top;
-		_str.right = _left;
-		_str.bottom = _top;
+		_str.left = shadow_left;
+		_str.top = shadow_top;
+		_str.right = shadow_left;
+		_str.bottom = shadow_top;
 		_firstChar = false;
 	}
 
@@ -868,16 +877,20 @@
 	if (chr >= 256 && _vm->_CJKMode)
 		width = 16;
 
+	shadow_right = _left + width + 2;
+	shadow_bottom = _top + height + 2;
+
 	_hasMask = true;
 	_current->drawShadowChar(chr, _left, _top, _color, !_ignoreCharsetMask);
-	_vm->updateDirtyRect(0, _left, _left + width, _top, _top + height, 0);
+	_vm->updateDirtyRect(0, shadow_left, shadow_right, shadow_top, shadow_bottom, 0);
 
 	_left += width;
-	if (_left > _str.right)
-		_str.right = _left;
 
-	if (_top + height > _str.bottom)
-		_str.bottom = _top + height;
+	if (shadow_right > _str.right)
+		_str.right = shadow_right;
+
+	if (shadow_bottom > _str.bottom)
+		_str.bottom = shadow_bottom;
 }
 
 #ifdef __PALM_OS__





More information about the Scummvm-git-logs mailing list