[Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.195,1.196 base-costume.h,1.30,1.31 base-costume.cpp,2.20,2.21 costume.cpp,1.144,1.145

Max Horn fingolfin at users.sourceforge.net
Fri Oct 8 17:11:00 CEST 2004


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

Modified Files:
	akos.cpp base-costume.h base-costume.cpp costume.cpp 
Log Message:
Fix for bug #1042802 (DIG: Graphics glitch when scrolling) -- the fix is to properly distinguish pitch and width of the target surface

Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.195
retrieving revision 1.196
diff -u -d -r1.195 -r1.196
--- akos.cpp	8 Oct 2004 07:07:34 -0000	1.195
+++ akos.cpp	9 Oct 2004 00:06:36 -0000	1.196
@@ -537,7 +537,7 @@
 						return;
 					}
 				} else {
-					masked = (y < 0 || y >= _outheight) || (*mask & maskbit);
+					masked = (y < 0 || y >= _out.h) || (*mask & maskbit);
 
 					if (color && !masked && !skip_column) {
 						pcolor = palette[color];
@@ -555,7 +555,7 @@
 						*dst = pcolor;
 					}
 				}
-				dst += _outwidth;
+				dst += _out.pitch;
 				mask += _numStrips;
 				y++;
 			}
@@ -569,7 +569,7 @@
 
 				if (_scaleX == 255 || v1.scaletable[v1.scaleXindex] < _scaleX) {
 					v1.x += v1.scaleXstep;
-					if (v1.x < 0 || v1.x >= _outwidth)
+					if (v1.x < 0 || v1.x >= _out.w)
 						return;
 					maskbit = revBitMask[(v1.x + _vm->virtscr[0].xstart) & 7];
 					v1.destptr += v1.scaleXstep;
@@ -802,7 +802,7 @@
 
 			j = startScaleIndexX;
 			for (i = 0; i < _width; i++) {
-				if (rect.left >= _outwidth) {
+				if (rect.left >= _out.w) {
 					startScaleIndexX = j;
 					skip++;
 				}
@@ -871,10 +871,10 @@
 	} else
 		_vm->markRectAsDirty(kMainVirtScreen, rect, _actorID);
 
-	if (rect.top >= _outheight || rect.bottom <= 0)
+	if (rect.top >= _out.h || rect.bottom <= 0)
 		return 0;
 
-	if (rect.left >= _outwidth || rect.right <= 0)
+	if (rect.left >= _out.w || rect.right <= 0)
 		return 0;
 
 	v1.replen = 0;
@@ -887,7 +887,7 @@
 			codec1_ignorePakCols(skip);
 			v1.x = 0;
 		} else {
-			skip = rect.right - _outwidth;
+			skip = rect.right - _out.w;
 			if (skip <= 0) {
 				drawFlag = 2;
 			} else {
@@ -896,11 +896,11 @@
 		}
 	} else {
 		if (!use_scaling)
-			skip = rect.right - _outwidth + 1;
+			skip = rect.right - _out.w + 1;
 		if (skip > 0) {
 			v1.skip_width -= skip;
 			codec1_ignorePakCols(skip);
-			v1.x = _outwidth - 1;
+			v1.x = _out.w - 1;
 		} else {
 			skip = -1 - rect.left;
 			if (skip <= 0)
@@ -919,18 +919,18 @@
 	if (rect.top < 0)
 		rect.top = 0;
 
-	if (rect.top > _outheight)
-		rect.top = _outheight;
+	if (rect.top > _out.h)
+		rect.top = _out.h;
 
-	if (rect.bottom > _outheight)
-		rect.bottom = _outheight;
+	if (rect.bottom > _out.h)
+		rect.bottom = _out.h;
 
 	if (_draw_top > rect.top)
 		_draw_top = rect.top;
 	if (_draw_bottom < rect.bottom)
 		_draw_bottom = rect.bottom;
 
-	v1.destptr = _outptr + v1.y * _outwidth + v1.x;
+	v1.destptr = (byte *)_out.pixels + v1.y * _out.pitch + v1.x;
 
 	codec1_genericDecode();
 	
@@ -956,8 +956,8 @@
 	clip.top = _actorY + ymoveCur;
 	clip.right = clip.left + _width;
 	clip.bottom = clip.top + _height;
-	maxw = _outwidth;
-	maxh = _outheight;
+	maxw = _out.w;
+	maxh = _out.h;
 
 	_vm->markRectAsDirty(kMainVirtScreen, clip, _actorID);
 
@@ -976,7 +976,7 @@
 	bdd.srcwidth = _width;
 	bdd.srcheight = _height;
 	bdd.dst = _vm->virtscr[kMainVirtScreen];
-	bdd.dst.pixels = _outptr;
+	bdd.dst.pixels = _out.pixels;
 	bdd.dataptr = _srcptr;
 	bdd.scale_x = 255;
 	bdd.scale_y = 255;
@@ -1124,8 +1124,8 @@
 	clip.top = _actorY + ymoveCur;
 	clip.right = clip.left + _width;
 	clip.bottom = clip.top + _height;
-	maxw = _outwidth;
-	maxh = _outheight;
+	maxw = _out.w;
+	maxh = _out.h;
 
 	if (_vm->_heversion >= 71) {
 		clip.clip(_clipOverride);
@@ -1169,8 +1169,6 @@
 	int32 width_unk, height_unk;
 
 	height_unk = clip.top;
-	int32 pitch = _outwidth;
-
 	int32 dir;
 
 	if (!_mirror) {
@@ -1202,9 +1200,9 @@
 	int32 numskip_before = skip_x + (skip_y * _width);
 	int32 numskip_after = _width - cur_x;
 
-	byte *dst = _outptr + width_unk + height_unk * _outwidth;
+	byte *dst = (byte *)_out.pixels + width_unk + height_unk * _out.pitch;
 
-	akos16Decompress(dst, pitch, _srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency, clip.left, clip.top, _zbuf);
+	akos16Decompress(dst, _out.pitch, _srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency, clip.left, clip.top, _zbuf);
 	return 0;
 }
 
@@ -1232,11 +1230,11 @@
 	if (_draw_bottom < dst.bottom)
 		_draw_bottom = dst.bottom;
 
-	byte *dstPtr = _outptr + dst.left + dst.top * _outwidth;
+	byte *dstPtr = (byte *)_out.pixels + dst.left + dst.top * _out.pitch;
 
 	for (int i = 0; i < 256; i++)
 		_vm->gdi._wizImagePalette[i] = i;
-	_vm->gdi.decompressWizImage(dstPtr, _outwidth, dst, _srcptr, src);
+	_vm->gdi.decompressWizImage(dstPtr, _out.pitch, dst, _srcptr, src);
 	return 0;
 }
 

Index: base-costume.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/base-costume.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- base-costume.h	4 Oct 2004 06:20:10 -0000	1.30
+++ base-costume.h	9 Oct 2004 00:06:36 -0000	1.31
@@ -71,8 +71,7 @@
 	ScummEngine *_vm;
 
 	// Destination
-	byte *_outptr;
-	int _outwidth, _outheight;
+	Graphics::Surface _out;
 	int32 _numStrips;
 
 	// Source pointer
@@ -119,14 +118,6 @@
 		_width = _height = 0;
 		_skipLimb = 0;
 		_transparency = 0;
-		
-		_clipOverride.right = 0;
-		_clipOverride.left = 0;
-		_clipOverride.top = 0;
-		_clipOverride.bottom = 0;
-
-		_outptr = 0;
-		_outwidth = _outheight = 0;
 	}
 
 	virtual void setPalette(byte *palette) = 0;

Index: base-costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/base-costume.cpp,v
retrieving revision 2.20
retrieving revision 2.21
diff -u -d -r2.20 -r2.21
--- base-costume.cpp	24 Sep 2004 21:36:04 -0000	2.20
+++ base-costume.cpp	9 Oct 2004 00:06:36 -0000	2.21
@@ -29,13 +29,12 @@
 	int i;
 	byte result = 0;
 
+	_out = vs;
 	if (drawToBackBuf)
-		_outptr = vs.getBackPixels(0, 0);
+		_out.pixels = vs.getBackPixels(0, 0);
 	else
-		_outptr = vs.getPixels(0, 0);
+		_out.pixels = vs.getPixels(0, 0);
 
-	_outwidth = vs.pitch;
-	_outheight = vs.h;
 	_numStrips = numStrips;
 
 	if (_vm->_version == 1) {

Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.cpp,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -d -r1.144 -r1.145
--- costume.cpp	6 Oct 2004 10:20:21 -0000	1.144
+++ costume.cpp	9 Oct 2004 00:06:36 -0000	1.145
@@ -157,7 +157,7 @@
 
 			_scaleIndexX = startScaleIndexX;
 			for (i = 0; i < _width; i++) {
-				if (rect.left >= _outwidth) {
+				if (rect.left >= _out.w) {
 					startScaleIndexX = _scaleIndexX;
 					skip++;
 				}
@@ -219,10 +219,10 @@
 	else
 		_vm->markRectAsDirty(kMainVirtScreen, rect.left, rect.right + 1, rect.top, rect.bottom, _actorID);
 
-	if (rect.top >= _outheight || rect.bottom <= 0)
+	if (rect.top >= _out.h || rect.bottom <= 0)
 		return 0;
 
-	if (rect.left >= _outwidth || rect.right <= 0)
+	if (rect.left >= _out.w || rect.right <= 0)
 		return 0;
 
 	v1.replen = 0;
@@ -237,7 +237,7 @@
 				v1.x = 0;
 			}
 		} else {
-			skip = rect.right - _outwidth;
+			skip = rect.right - _out.w;
 			if (skip <= 0) {
 				drawFlag = 2;
 			} else {
@@ -246,12 +246,12 @@
 		}
 	} else {
 		if (!use_scaling)
-			skip = rect.right - _outwidth;
+			skip = rect.right - _out.w;
 		if (skip > 0) {
 			if (!newAmiCost && _loaded._format != 0x57) {
 				v1.skip_width -= skip;
 				codec1_ignorePakCols(skip);
-				v1.x = _outwidth - 1;
+				v1.x = _out.w - 1;
 			}
 		} else {
 			// V1 games uses 8 x 8 pixels for actors
@@ -275,11 +275,11 @@
 	if (rect.top < 0)
 		rect.top = 0;
 
-	if (rect.top > _outheight)
-		rect.top = _outheight;
+	if (rect.top > _out.h)
+		rect.top = _out.h;
 
-	if (rect.bottom > _outheight)
-		rect.bottom = _outheight;
+	if (rect.bottom > _out.h)
+		rect.bottom = _out.h;
 
 	if (_draw_top > rect.top)
 		_draw_top = rect.top;
@@ -291,7 +291,7 @@
 		return 2;
 	}
 
-	v1.destptr = _outptr + v1.y * _outwidth + v1.x;
+	v1.destptr = (byte *)_out.pixels + v1.y * _out.pitch + v1.x;
 
 	v1.mask_ptr = _vm->getMaskBuffer(0, v1.y, _zbuf);
 
@@ -374,14 +374,14 @@
 			if (!rep)
 				color = *src++;
 			
-			if (0 <= y && y < _outheight && 0 <= v1.x && v1.x < _outwidth) {
+			if (0 <= y && y < _out.h && 0 <= v1.x && v1.x < _out.w) {
 				if (!_mirror) {
 					LINE(0, 0); LINE(2, 2); LINE(4, 4); LINE(6, 6);
 				} else {
 					LINE(6, 0); LINE(4, 2); LINE(2, 4); LINE(0, 6);
 				}
 			}
-			dst += _outwidth;
+			dst += _out.pitch;
 			y++;
 			mask += _numStrips;
 			if (!--height) {
@@ -390,7 +390,7 @@
 				height = _height;
 				y = v1.y;
 				v1.x += 8 * v1.scaleXstep;
-				if (v1.x < 0 || v1.x >= _outwidth)
+				if (v1.x < 0 || v1.x >= _out.w)
 					return;
 				mask = v1.mask_ptr;
 				v1.destptr += 8 * v1.scaleXstep;
@@ -455,7 +455,7 @@
 
 		do {
 			if (_scaleY == 255 || *scaleytab++ < _scaleY) {
-				masked = (y < 0 || y >= _outheight) || (v1.mask_ptr && (mask[0] & maskbit));
+				masked = (y < 0 || y >= _out.h) || (v1.mask_ptr && (mask[0] & maskbit));
 				
 				if (color && !masked) {
 					// FIXME: Fully implement _shadow_mode.in Sam & Max
@@ -469,7 +469,7 @@
 					}
 					*dst = pcolor;
 				}
-				dst += _outwidth;
+				dst += _out.pitch;
 				mask += _numStrips;
 				y++;
 			}
@@ -483,7 +483,7 @@
 
 				if (_scaleX == 255 || v1.scaletable[_scaleIndexX] < _scaleX) {
 					v1.x += v1.scaleXstep;
-					if (v1.x < 0 || v1.x >= _outwidth)
+					if (v1.x < 0 || v1.x >= _out.w)
 						return;
 					maskbit = revBitMask[v1.x & 7];
 					v1.destptr += v1.scaleXstep;
@@ -524,9 +524,9 @@
 			len = *src++;
 		do {
 			if (_scaleY == 255 || v1.scaletable[_scaleIndexY] < _scaleY) {
-				masked = (y < 0 || y >= _outheight) || (v1.mask_ptr && (mask[0] & maskbit));
+				masked = (y < 0 || y >= _out.h) || (v1.mask_ptr && (mask[0] & maskbit));
 				
-				if (color && v1.x >= 0 && v1.x < _outwidth && !masked) {
+				if (color && v1.x >= 0 && v1.x < _out.w && !masked) {
 					*dst = _palette[color];
 				}
 
@@ -542,11 +542,11 @@
 				if (!--height)
 					return;
 
-				if (y >= _outheight)
+				if (y >= _out.h)
 					return;
 
 				if (v1.x != oldXpos) {
-					dst += _outwidth - (v1.x - oldXpos);
+					dst += _out.pitch - (v1.x - oldXpos);
 					v1.mask_ptr += _numStrips;
 					mask = v1.mask_ptr;
 					y++;





More information about the Scummvm-git-logs mailing list