Optionally don't clear the fbcon framebuffer on shutdown.

The new behavior is triggered by setting the environment variable
SDL_FBCON_DONT_CLEAR.

This is useful in certain circumstances (specifically: a game launcher on an
embedded device can leave a "now loading!" screen on the framebuffer while
another process is starting up).

Fixes Bugzilla #1251.

Thanks to Paul Cercueil for the patch!

--HG--
branch : SDL-1.2
This commit is contained in:
Ryan C. Gordon 2011-08-21 09:26:56 -04:00
parent 59a7f8a598
commit fcf143d294

View file

@ -1910,7 +1910,16 @@ static void FB_VideoQuit(_THIS)
if ( this->screen ) {
/* Clear screen and tell SDL not to free the pixels */
if ( this->screen->pixels && FB_InGraphicsMode(this) ) {
const char *dontClearPixels = SDL_getenv("SDL_FBCON_DONT_CLEAR");
/* If the framebuffer is not to be cleared, make sure that we won't
* display the previous frame when disabling double buffering. */
if ( dontClearPixels && flip_page == 0 ) {
SDL_memcpy(flip_address[0], flip_address[1], this->screen->pitch * this->screen->h);
}
if ( !dontClearPixels && this->screen->pixels && FB_InGraphicsMode(this) ) {
#if defined(__powerpc__) || defined(__ia64__) /* SIGBUS when using SDL_memset() ?? */
Uint8 *rowp = (Uint8 *)this->screen->pixels;
int left = this->screen->pitch*this->screen->h;