Skip to content

Fix that for one-off renders, rendering twice might be required so it shows on screen

Ellie requested to merge ell1e/osk-sdl:double-buffer-render-fix into master

I noticed that during testing and also on-device the error message for incorrect password sometimes won't show, or the message will only show once clicking/tapping once afterwards.

This is fixed by this merge request. The problem is basically that osk-sdl likes to hang in SDL_WaitEvent() for a long time when there's nothing to do (which in itself isn't a bad idea) but the last SDL_RenderPresent() might only reach the back buffer with the double buffering used on modern graphics hardware. Therefore, if a long render pause is anticipated,it is necessary to render things twice to make sure it reaches the screen before going into a long pause. I updated the main loop to reflect this.

I also added an explanatory comment into main.cpp so that hopefully, future coders will understand why this is done.

Warning: not tested on-device yet!

Note: I updated the copyright notices in the files I touched and added "et al.", since adding all names manually might become too cumbersome soon. Since the authors are still in the git history, that seems good enough for me.

Note 2: cppcheck was annoyed with cur_ticks = 0; even though I didn't even change that (and I think it's reasonable to keep as-is), so I enabled inline suppressions and added a comment explaining why it's ok. Wasn't meant to be part of this merge request, but cppcheck insisted that I somehow deal with it 🤷

Edited by Ellie

Merge request reports