diff options
Diffstat (limited to 'backends')
-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(); |