From d4e5e09ffa113bc23388a424545114a0b73e0bdd Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Fri, 1 Aug 2014 03:48:24 +0200 Subject: [PATCH] Clear the screen to avoid garbage in unreachable areas after we reset the coordinate system --- src/video/sdl/sdl_renderer.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/video/sdl/sdl_renderer.cpp b/src/video/sdl/sdl_renderer.cpp index 6f194f3fa..61504e72f 100644 --- a/src/video/sdl/sdl_renderer.cpp +++ b/src/video/sdl/sdl_renderer.cpp @@ -313,6 +313,19 @@ SDLRenderer::apply_config() SCREEN_HEIGHT = static_cast(max_size.height); } } + + // Clear the screen to avoid garbage in unreachable areas after we + // reset the coordinate system + SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); + SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE); + SDL_RenderClear(renderer); + SDL_RenderPresent(renderer); + SDL_RenderClear(renderer); + + // This doesn't really do what we want, as it sales the area to fill + // the screen, but seems to be the only way to reset the coordinate + // system and it's "close enough" to what we want, see: + // https://bugzilla.libsdl.org/show_bug.cgi?id=2179 SDL_RenderSetLogicalSize(renderer, SCREEN_WIDTH, SCREEN_HEIGHT); } -- 2.11.0