aboutsummaryrefslogtreecommitdiff
path: root/backends/sdl/graphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/sdl/graphics.cpp')
-rw-r--r--backends/sdl/graphics.cpp14
1 files changed, 14 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;