[Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.114,1.115 costume.cpp,1.126,1.127

Max Horn fingolfin at users.sourceforge.net
Sat Apr 3 13:09:09 CEST 2004


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11388

Modified Files:
	akos.cpp costume.cpp 
Log Message:
fixed hypothetical off-by-one error when computing _draw_bottom (a semantical problem: _draw_bottom is supposed to be the bottom most pixel which is actually drawn; in the other case, it's top+height, i.e. one pixel *below* that last drawn pixel row. In addition, some cleanup

Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -d -r1.114 -r1.115
--- akos.cpp	27 Mar 2004 20:55:24 -0000	1.114
+++ akos.cpp	3 Apr 2004 20:56:19 -0000	1.115
@@ -732,8 +732,8 @@
 
 	if (_draw_top > rect.top)
 		_draw_top = rect.top;
-	if (_draw_bottom < rect.bottom)
-		_draw_bottom = rect.bottom;
+	if (_draw_bottom < rect.bottom - 1)
+		_draw_bottom = rect.bottom - 1;
 
 	v1.destptr = _outptr + v1.y * _outwidth + v1.x;
 
@@ -762,22 +762,22 @@
 	}
 
 	clip.top = _actorY + ymoveCur;
-	clip.right = (clip.left + _width) - 1;
-	clip.bottom = (clip.top + _height) - 1;
-	maxw = _outwidth - 1;
-	maxh = _outheight - 1;
+	clip.right = clip.left + _width;
+	clip.bottom = clip.top + _height;
+	maxw = _outwidth;
+	maxh = _outheight;
 
-	_vm->markRectAsDirty(kMainVirtScreen, clip.left, clip.right + 1, clip.top, clip.bottom + 1, _actorID);
+	_vm->markRectAsDirty(kMainVirtScreen, clip , _actorID);
 
 	clip.clip(maxw, maxh);
 
-	if ((clip.left >= clip.right) || (clip.top >= clip.bottom))
+	if (!clip.isValidRect())
 		return 0;
 
 	if (_draw_top > clip.top)
 		_draw_top = clip.top;
-	if (_draw_bottom < clip.bottom)
-		_draw_bottom = clip.bottom + 1;
+	if (_draw_bottom < clip.bottom - 1)
+		_draw_bottom = clip.bottom - 1;
 
 	BompDrawData bdd;
 
@@ -805,10 +805,8 @@
 
 	if (_zbuf != 0) {
 		bdd.maskPtr = _vm->getMaskBuffer(0, 0, _zbuf);
-		_vm->drawBomp(bdd, !_mirror);
-	} else {
-		_vm->drawBomp(bdd, !_mirror);
 	}
+	_vm->drawBomp(bdd, !_mirror);
 
 	_vm->_bompActorPalettePtr = NULL;
 	
@@ -966,17 +964,17 @@
 	}
 
 	clip.top = ymoveCur + _actorY;
-	clip.right = (clip.left + _width) - 1;
-	clip.bottom = (clip.top + _height) - 1;
-	maxw = _outwidth - 1;
-	maxh = _outheight - 1;
+	clip.right = clip.left + _width;
+	clip.bottom = clip.top + _height;
+	maxw = _outwidth;
+	maxh = _outheight;
 
 	skip_x = 0;
 	skip_y = 0;
 	cur_x = _width - 1;
 	cur_y = _height - 1;
 
-	_vm->markRectAsDirty(kMainVirtScreen, clip.left, clip.right + 1, clip.top, clip.bottom + 1, _actorID);
+	_vm->markRectAsDirty(kMainVirtScreen, clip, _actorID);
 
 	if (clip.left < 0) {
 		skip_x = -clip.left;
@@ -998,13 +996,13 @@
 		clip.bottom = maxh;
 	}
 
-	if ((clip.left >= clip.right) || (clip.top >= clip.bottom))
+	if (!clip.isValidRect())
 		return 0;
 
 	if (_draw_top > clip.top)
 		_draw_top = clip.top;
-	if (_draw_bottom < clip.bottom)
-		_draw_bottom = clip.bottom + 1;
+	if (_draw_bottom < clip.bottom - 1)
+		_draw_bottom = clip.bottom - 1;
 
 	int32 width_unk, height_unk;
 
@@ -1019,7 +1017,7 @@
 		int tmp_skip_x = skip_x;
 		skip_x = _width - 1 - cur_x;
 		cur_x = _width - 1 - tmp_skip_x;
-		width_unk = clip.right;
+		width_unk = clip.right - 1;
 	} else {
 		dir = 1;
 		width_unk = clip.left;

Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.cpp,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -d -r1.126 -r1.127
--- costume.cpp	8 Jan 2004 03:10:16 -0000	1.126
+++ costume.cpp	3 Apr 2004 20:56:19 -0000	1.127
@@ -262,8 +262,8 @@
 
 	if (_draw_top > rect.top)
 		_draw_top = rect.top;
-	if (_draw_bottom < rect.bottom)
-		_draw_bottom = rect.bottom;
+	if (_draw_bottom < rect.bottom - 1)
+		_draw_bottom = rect.bottom - 1;
 
 	if (_height + rect.top >= 256) {
 		CHECK_HEAP





More information about the Scummvm-git-logs mailing list