diff options
author | James Brown | 2004-11-13 04:33:33 +0000 |
---|---|---|
committer | James Brown | 2004-11-13 04:33:33 +0000 |
commit | 2ae3166f2db47b7beb5225d57b5e271de33ab9cd (patch) | |
tree | 39990f576a436da88699af15d525e942a4a9f02e /backends/sdl | |
parent | 628b02a9e8183001279c7ecbf59d38456993aa8c (diff) | |
download | scummvm-rg350-2ae3166f2db47b7beb5225d57b5e271de33ab9cd.tar.gz scummvm-rg350-2ae3166f2db47b7beb5225d57b5e271de33ab9cd.tar.bz2 scummvm-rg350-2ae3166f2db47b7beb5225d57b5e271de33ab9cd.zip |
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.
svn-id: r15799
Diffstat (limited to 'backends/sdl')
-rw-r--r-- | backends/sdl/graphics.cpp | 14 | ||||
-rw-r--r-- | backends/sdl/sdl-common.h | 3 |
2 files changed, 17 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(); |