diff options
| -rw-r--r-- | backends/sdl/graphics.cpp | 14 | ||||
| -rw-r--r-- | backends/sdl/sdl-common.h | 3 | ||||
| -rw-r--r-- | base/main.cpp | 3 | ||||
| -rw-r--r-- | common/system.h | 3 | 
4 files changed, 23 insertions, 0 deletions
| diff --git a/backends/sdl/graphics.cpp b/backends/sdl/graphics.cpp index f6b981110d..ed4a3cbd1e 100644 --- a/backends/sdl/graphics.cpp +++ b/backends/sdl/graphics.cpp @@ -514,6 +514,20 @@ void OSystem_SDL::setFullscreenMode(bool enable) {  	}  } +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; diff --git a/backends/sdl/sdl-common.h b/backends/sdl/sdl-common.h index fde699ae6b..646c9a262e 100644 --- a/backends/sdl/sdl-common.h +++ b/backends/sdl/sdl-common.h @@ -64,6 +64,9 @@ public:  	// 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(); diff --git a/base/main.cpp b/base/main.cpp index 1844bbdd63..7b6cf30176 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -195,6 +195,9 @@ static int launcherDialog(GameDetector &detector, OSystem *system) {  	// to fix all backends to support it, if they don't already.  	system->initSize(320, 200); +	// Clear the main screen +	system->clearScreen(); +  	// FIXME - mouse cursors are currently always set via 8 bit data.  	// Thus for now we need to setup a dummy palette. On the long run, we might  	// want to add a setMouseCursor_overlay() method to OSystem, which would serve diff --git a/common/system.h b/common/system.h index 2f2aeab7ec..fcff39b567 100644 --- a/common/system.h +++ b/common/system.h @@ -254,6 +254,9 @@ public:  	 *       API are probably going to remove it.  	 */  	virtual void setPalette(const byte *colors, uint start, uint num) = 0; +	 +	/** Clear the screen to black */ +	virtual void clearScreen() {;}  	/**  	 * Blit a bitmap to the virtual screen. | 
