[Scummvm-cvs-logs] CVS: scummvm/bs2/driver driver96.h,1.18,1.19 render.cpp,1.7,1.8

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Mon Aug 18 00:50:20 CEST 2003


Update of /cvsroot/scummvm/scummvm/bs2/driver
In directory sc8-pr-cvs1:/tmp/cvs-serv8042/driver

Modified Files:
	driver96.h render.cpp 
Log Message:
Added support for opaque surfaces (it's the default now, actually) since it
looks like the sprite renderer may need them.


Index: driver96.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/driver/driver96.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- driver96.h	17 Aug 2003 14:07:16 -0000	1.18
+++ driver96.h	18 Aug 2003 07:46:46 -0000	1.19
@@ -1262,11 +1262,13 @@
 	uint16 _width, _height;
 	uint16 _pitch;
 	byte *_pixels;
+	int _colorKey;
 
 	Surface(uint width, uint height) {
 		_width = width;
 		_height = height;
 		_pixels = (byte *) calloc(_width, _height);
+		_colorKey = -1;
 	};
 
 	~Surface() {
@@ -1276,6 +1278,9 @@
 	void clear();
 	void blit(Surface *s, ScummVM::Rect *r);
 	void blit(Surface *s, ScummVM::Rect *r, ScummVM::Rect *clip_rect);
+	void setColorKey(int colorKey) {
+		_colorKey = colorKey;
+	};
 };
 
 //

Index: render.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/driver/render.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- render.cpp	17 Aug 2003 14:07:16 -0000	1.7
+++ render.cpp	18 Aug 2003 07:46:46 -0000	1.8
@@ -326,13 +326,21 @@
 	// several times, as each new parallax layer is rendered, this may be
 	// a bit inefficient.
 
-	for (i = 0; i < r->bottom - r->top; i++) {
-		for (j = 0; j < r->right - r->left; j++) {
-			if (src[j])
-				dst[j] = src[j];
+	if (s->_colorKey >= 0) {
+		for (i = 0; i < r->bottom - r->top; i++) {
+			for (j = 0; j < r->right - r->left; j++) {
+				if (src[j] != s->_colorKey)
+					dst[j] = src[j];
+			}
+			src += s->_width;
+			dst += _width;
+		}
+	} else {
+		for (i = 0; i < r->bottom - r->top; i++) {
+			memcpy(dst, src, r->right - r->left);
+			src += s->_width;
+			dst += _width;
 		}
-		src += s->_width;
-		dst += _width;
 	}
 
 	g_sword2->_system->copy_rect(_pixels + r->top * _width + r->left, _width, r->left, r->top, r->right - r->left, r->bottom - r->top);
@@ -1292,6 +1300,7 @@
 
 		if (block_has_data) {
 			blockSurfaces[layer][i] = new Surface(BLOCKWIDTH, BLOCKHEIGHT);
+			blockSurfaces[layer][i]->setColorKey(0);
 
 			//  Copy the data into the surfaces.
 			dst = blockSurfaces[layer][i]->_pixels;





More information about the Scummvm-git-logs mailing list