Skip to content

Commit

Permalink
Clear the screen to avoid garbage in unreachable areas after we reset…
Browse files Browse the repository at this point in the history
… the coordinate system
  • Loading branch information
Grumbel committed Aug 1, 2014
1 parent 91c1517 commit d4e5e09
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/video/sdl/sdl_renderer.cpp
Expand Up @@ -313,6 +313,19 @@ SDLRenderer::apply_config()
SCREEN_HEIGHT = static_cast<int>(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);
}

Expand Down

0 comments on commit d4e5e09

Please sign in to comment.