Dawoodoz / DFPSR

Fast realtime softare rendering library for C++14 using SSE/AVX/NEON. 2D, 3D and isometric rendering with minimal system dependencies.
https://dawoodoz.com/dfpsr.html
78 stars 6 forks source link

Fix window resize flicker on MS-Windows #86

Closed Dawoodoz closed 1 year ago

Dawoodoz commented 1 year ago

Getting black flickering on MS-Windows after implementing double buffering, so the flickering on X11 might have multiple causes. It could be that the first image after resize needs to duplicate the image and run on a single thread, just like when the window was recently created, so that one does not start by showing a previous image that does not exist.

Dawoodoz commented 1 year ago

Looking at the pixel data in each frame shows that it turns black because Windows in flooding the application with draw requests before the application has time to redraw content in the canvas.

Copying from the old canvas on resize made the flickering go away, but a callback to draw it right the first time would look better. Drawing on request would break pacing for games with heavy graphics, but an event is still needed to inform about the need to redraw.

Dawoodoz commented 1 year ago

Removed resize flicker on MS-Windows in the experimental branch, but there is still a gray repaint flicker when moving the window outside of the screen, and the same fix did not work on X11.