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 4562

Summary: Strange behaviour of SDL_SetVideoMode when using it to change between FULL_SCREEN and Windowed
Product: sdl12-compat Reporter: Dario <dankospam>
Component: everythingAssignee: Ryan C. Gordon <icculus>
Status: NEW --- QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2    
Version: unspecified   
Hardware: x86_64   
OS: Linux   
Attachments: Patch to resolve described issue.
A video showing game behaviour with submitted patch.
A video showing game behaviour without patch

Description Dario 2019-03-22 20:33:24 UTC
Created attachment 3708 [details]
Patch to resolve described issue.

I have a game that uses SDL_SetVideMode to run on SDL_FULLSCREEN mode on a 2560x1440. The non-scaled resolution of the game when running in fullscreen is 1280x720.

The game allows using non-full screen mode, and with GDB I have seen it results invoking SDL_SetVideoMode again without the SDL_FULLSCREEN flag. The target size of the window is 640 x 360.

For some reason, when switching from full screen to windowed, the "surface" does not get resized. It remains at 2560x1440 which results in a clipped area.

When SDL_SetVideoMode is invoked a second time with the 640x360 Windowed, the contents are resized correctly.

I was able to overcome this problem by forcing a EnvVidModeCreate() when the target width and height does not match the width and height that VideoSurface12 contained. See patch.

There might be however a better way of resolving this. I tried to do a lot of debugging but this is as far I could get :).
Comment 1 Dario 2019-03-22 20:57:46 UTC
Created attachment 3709 [details]
A video showing game behaviour with submitted patch.
Comment 2 Dario 2019-03-22 20:59:11 UTC
Created attachment 3710 [details]
A video showing game behaviour without patch