[Scummvm-cvs-logs] CVS: scummvm/backends/sdl sdl_gl.cpp,1.32,1.33

Travis Howell kirben at users.sourceforge.net
Tue Jun 17 10:35:10 CEST 2003


Update of /cvsroot/scummvm/scummvm/backends/sdl
In directory sc8-pr-cvs1:/tmp/cvs-serv10370/backends/sdl

Modified Files:
	sdl_gl.cpp 
Log Message:

OpenGL working right now


Index: sdl_gl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl_gl.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- sdl_gl.cpp	17 Jun 2003 16:06:17 -0000	1.32
+++ sdl_gl.cpp	17 Jun 2003 17:34:52 -0000	1.33
@@ -331,6 +331,9 @@
 }
 
 void OSystem_SDL_OpenGL::update_screen() {
+
+	StackLock lock(_mutex);	// Lock the mutex until this function ends
+
 	// If the shake position changed, fill the dirty area with blackness
 	if (_currentShakePos != _newShakePos) {
 		if (_usingOpenGL) {
@@ -383,37 +386,39 @@
 	if (_num_dirty_rects > 0) {
 	
 		SDL_Rect *r; 
-		SDL_Rect dst;
 		uint32 srcPitch, dstPitch;
 		SDL_Rect *last_rect = _dirty_rect_list + _num_dirty_rects;
 
 		// Convert appropriate parts of the 8bpp image into 16bpp
-		if (_scaler_proc == Normal1x) {
-			SDL_Surface *target = _overlayVisible ? _tmpscreen : _screen;
+		SDL_Rect dst;
+		if (!_overlayVisible) {
 			for(r = _dirty_rect_list; r != last_rect; ++r) {
 				dst = *r;
-				if (_overlayVisible) {
-					// FIXME: I don't understand why this is necessary...
-					dst.x--;
-					dst.y--;
-				}
-				if (_usingOpenGL) {
-					if (SDL_BlitSurface(target, r, _tmpscreen, &dst) != 0)
+				dst.x++;	// Shift rect by one since 2xSai needs to acces the data around
+				dst.y++;	// any pixel to scale it, and we want to avoid mem access crashes.
+				if (_scaler_proc == Normal1x) {
+				    if (_usingOpenGL) {
+					if (SDL_BlitSurface(_screen, r, _tmpscreen, &dst) != 0)
 						error("SDL_BlitSurface failed: %s", SDL_GetError());
 				    }
-				else { // SDL backend
-					if (SDL_BlitSurface(target, r, _hwscreen, &dst) != 0)
+				    else { // SDL backend
+					if (SDL_BlitSurface(_screen, r, _hwscreen, &dst) != 0)
 						error("SDL_BlitSurface failed: %s", SDL_GetError());
 				    }
+				} else { // _scaler_proc != Normal1x
+					if (SDL_BlitSurface(_screen, r, _tmpscreen, &dst) != 0)
+						error("SDL_BlitSurface failed: %s", SDL_GetError());
 				}
+			}
 		} else {
 		    if (!_usingOpenGL) {
-			if (!_overlayVisible) {
+			SDL_Surface *target = _overlayVisible ? _tmpscreen : _screen;
 			for(r = _dirty_rect_list; r != last_rect; ++r) {
 				dst = *r;
-				dst.x++;        // Shift rect by one since 2xSai needs to acces the data around
-				dst.y++;        // any pixel to scale it, and we want to avoid mem access crashes.
-				if (SDL_BlitSurface(_screen, r, _tmpscreen, &dst) != 0)
+				// FIXME: I don't understand why this is necessary...
+				dst.x--;
+				dst.y--;
+				if (SDL_BlitSurface(target, r, _hwscreen, &dst) != 0)
 					error("SDL_BlitSurface failed: %s", SDL_GetError());
 			}
 		    }
@@ -445,6 +450,7 @@
 		}
 		else { // SDL backend
 		
+		  if (_scaler_proc != Normal1x) {
 			SDL_LockSurface(_tmpscreen);
 			SDL_LockSurface(_hwscreen);
 





More information about the Scummvm-git-logs mailing list