[Scummvm-cvs-logs] CVS: scummvm/backends/sdl graphics.cpp,1.15,1.16 sdl-common.h,1.65,1.66

James Brown ender at users.sourceforge.net
Fri Nov 12 20:35:00 CET 2004


Update of /cvsroot/scummvm/scummvm/backends/sdl
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2267/backends/sdl

Modified Files:
	graphics.cpp sdl-common.h 
Log Message:
Add new clearScreen OSystem call. Currently only implemented in SDL backend. This call is currently only used for clearing the launcher screen to remove garbage from the main screen before reentering.


Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/graphics.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- graphics.cpp	15 Oct 2004 22:28:12 -0000	1.15
+++ graphics.cpp	13 Nov 2004 04:33:27 -0000	1.16
@@ -514,6 +514,20 @@
 	}
 }
 
+void OSystem_SDL::clearScreen() {
+	// Try to lock the screen surface
+	if (SDL_LockSurface(_screen) == -1)
+		error("SDL_LockSurface failed: %s", SDL_GetError());
+
+	byte *dst = (byte *)_screen->pixels;
+
+	// Clear the screen
+	memset(dst, 0, _screenWidth * _screenHeight);
+
+	// Unlock the screen surface
+	SDL_UnlockSurface(_screen);
+}
+
 void OSystem_SDL::copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h) {
 	if (_screen == NULL)
 		return;

Index: sdl-common.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.h,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- sdl-common.h	15 Oct 2004 22:28:12 -0000	1.65
+++ sdl-common.h	13 Nov 2004 04:33:27 -0000	1.66
@@ -64,6 +64,9 @@
 	// The screen will not be updated to reflect the new bitmap
 	void copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h);
 
+	// Clear the screen
+	void clearScreen();
+
 	// Update the dirty areas of the screen
 	void updateScreen();
 





More information about the Scummvm-git-logs mailing list