(sdl gfx) Replicate #12521 / Fix no menu on start (#14677)

#12521 fixes blank screens on the sdl_dingux driver, so just replicating that change here on the standard sdl_gfx driver.  Also, fix a problem where the menu will never show up in this driver, because you cannot blit to a surface in SDL while it is locked (i.e. after issuing an SDL_LockSurface command.
This commit is contained in:
andymcca 2022-11-26 20:05:30 +00:00 committed by GitHub
parent 31e549ce9c
commit 083b14b85c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -373,17 +373,23 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width,
bool menu_is_alive = video_info->menu_is_alive;
#endif
if (!frame)
if (!vid)
return true;
title[0] = '\0';
video_driver_get_window_title(title, sizeof(title));
if (SDL_MUSTLOCK(vid->screen))
SDL_LockSurface(vid->screen);
if (vid->menu.active) {
#ifdef HAVE_MENU
menu_driver_frame(menu_is_alive, video_info);
#endif
SDL_BlitSurface(vid->menu.frame, NULL, vid->screen, NULL);
} else {
if (SDL_MUSTLOCK(vid->screen))
SDL_LockSurface(vid->screen);
video_frame_scale(
video_frame_scale(
&vid->scaler,
vid->screen->pixels,
frame,
@ -393,23 +399,12 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width,
vid->screen->pitch,
width,
height,
pitch);
pitch);
#ifdef HAVE_MENU
menu_driver_frame(menu_is_alive, video_info);
if (vid->menu.active)
SDL_BlitSurface(vid->menu.frame, NULL, vid->screen, NULL);
#endif
if (msg)
sdl_render_msg(vid, vid->screen,
msg, vid->screen->w, vid->screen->h, vid->screen->format,
video_info->font_msg_pos_x,
video_info->font_msg_pos_y);
if (SDL_MUSTLOCK(vid->screen))
SDL_UnlockSurface(vid->screen);
if (SDL_MUSTLOCK(vid->screen))
SDL_UnlockSurface(vid->screen);
}
if (title[0])
SDL_WM_SetCaption(title, NULL);