We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3963

Summary: SDL Window clearing when minimizing RDP session, restoring Android from background, randomly when running other programs on top.
Product: SDL Reporter: superfury
Component: renderAssignee: Sam Lantinga <slouken>
Status: NEW --- QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2    
Version: 2.0.5   
Hardware: All   
OS: Windows 10   

Description superfury 2017-11-15 12:31:26 UTC
During rendering on SDL2 2.0.5+, randomly output becomes blanked. Also, when minimizing the Windows 10 RDP session and restoring it and rendering a frame after that, as well as restoring on Android(changing from backgrounded state back into foreground state) has the same behaviour. The next time the display is updated, it refreshes the window/screen, restoring all contents in the main SDL2 surface's pixels variable(verified with a white pixel always plotted in the top left corner when updating the screen, it doesn't even show up when rendering after minimizing the RDP/Android program(the same applies to the backgrounding, or making the window inactive, of the program by making another program active instead, overlapping the window(but not always, it happens without overlapping windows as well, it seems))).

Window updating code(SDL 1.2 compatible as well), only called when something has changed on the program's main SDL surface's pixels:
				#ifndef SDL2
				if (SDL_Flip(surface->sdllayer)==-1) //Failed to update by flipping?
					SDL_UpdateRect(surface->sdllayer, 0, 0, 0, 0); //Make sure we update!
				#else
				//SDL2!
				// Update the texture based on the pixels to be displayed!
				SDL_UpdateTexture(sdlTexture, NULL, *getlayerpixels(surface), (get_pixelrow_pitch(surface)<<2));
				// Select the color for drawing. It is set to black here.
				SDL_SetRenderDrawColor(sdlRenderer, 0x00, 0x00, 0x00, SDL_ALPHA_OPAQUE);
				// Clear the entire screen to our selected color.
				SDL_RenderClear(sdlRenderer);
				// Copy over our display!
				SDL_RenderCopy(sdlRenderer, sdlTexture, NULL, NULL);

				// Up until now everything was drawn behind the scenes.
				// This will show the new contents of the window.
				SDL_RenderPresent(sdlRenderer);
				#endif