[Scummvm-cvs-logs] CVS: residual smush.cpp,1.20,1.21 smush.h,1.6,1.7

Pawel Kolodziejski aquadran at users.sourceforge.net
Sat Feb 21 10:01:09 CET 2004


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

Modified Files:
	smush.cpp smush.h 
Log Message:
moved update gl frame code to main thread

Index: smush.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/smush.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- smush.cpp	1 Feb 2004 13:53:37 -0000	1.20
+++ smush.cpp	21 Feb 2004 17:48:45 -0000	1.21
@@ -116,12 +116,14 @@
 		}
 	} while (pos < size);
 	free(frame);
+
+	memcpy(_buf, _dst, _width * _height * 2);
+	_updateNeeded = true;
+
 	_frame++;
 	if (_frame == _nbframes) {
 		_videoFinished = true;
 	}
-
-	g_driver->drawSMUSHframe(_width, _height, _dst);
 }
 
 void Smush::handleFramesHeader() {
@@ -274,6 +276,8 @@
 
 	SDL_Surface* image;
 	image = SDL_CreateRGBSurface(SDL_SWSURFACE, _width, _height, 16, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000);
+	SDL_Surface* buf_image;
+	buf_image = SDL_CreateRGBSurface(SDL_SWSURFACE, _width, _height, 16, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000);
 
 	SDL_Rect src;
 	src.x = 0;
@@ -282,13 +286,21 @@
 	src.h = image->h;
 
 	_dst = (byte *)image->pixels;
+	_buf = (byte *)buf_image->pixels;
+
+	_updateNeeded = false;
 
 	init();
 
 	while (!_videoFinished) {
 		
+		if (_updateNeeded) {
+			g_driver->drawSMUSHframe(_width, _height, _dst);
+			_updateNeeded = false;
+		}
+
 		SDL_Event event;
-		while (SDL_PollEvent(&event)) {
+		if (SDL_PollEvent(&event)) {
 			// Skip cutscene?
 			if (event.type == SDL_KEYDOWN)
 				if (event.key.keysym.sym == SDLK_ESCAPE)

Index: smush.h
===================================================================
RCS file: /cvsroot/scummvm/residual/smush.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- smush.h	1 Feb 2004 13:27:25 -0000	1.6
+++ smush.h	21 Feb 2004 17:48:45 -0000	1.7
@@ -105,13 +105,15 @@
 	PlayingSoundHandle _soundHandle;
 
 	int32 _frame;
+	bool _updateNeeded;
 	bool _alreadyInit;
 	int32 _speed;
 	int _channels;
 	int _freq;
 	bool _videoFinished;
 	int _width, _height;
-	uint8 *_dst;
+	byte *_dst;
+	byte *_buf;
 
 public:
 	Smush();





More information about the Scummvm-git-logs mailing list