Skip to content

Commit

Permalink
atari:video:xbios: properly initialize double buffering
Browse files Browse the repository at this point in the history
  • Loading branch information
mikrosk committed Jul 7, 2024
1 parent aba1988 commit 3a0c3a4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/video/xbios/SDL_xbios.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,14 +504,21 @@ static SDL_Surface *XBIOS_SetVideoMode(_THIS, SDL_Surface *current,
/* this is for C2P conversion */
XBIOS_pitch = (*XBIOS_getLineWidth)(this, new_video_mode, new_video_mode->width, new_video_mode->depth);

/* XBIOS_setMode() is going to call SetScreen(XBIOS_screens[0])
* and XBIOS_swapVbuffers() is going to call Setscreen(XBIOS_screens[XBIOS_fbnum])
* so these can't be the same buffers if double buffering has been requested.
*/
XBIOS_fbnum = num_buffers-1;
XBIOS_current = new_video_mode;

current->w = width;
current->h = height;
current->pitch = lineWidth;

if (XBIOS_shadowscreen)
current->pixels = XBIOS_shadowscreen;
else
current->pixels = XBIOS_screens[0];
current->pixels = XBIOS_screens[XBIOS_fbnum];

#if SDL_VIDEO_OPENGL
if (flags & SDL_OPENGL) {
Expand All @@ -534,9 +541,6 @@ static SDL_Surface *XBIOS_SetVideoMode(_THIS, SDL_Surface *current,
(*XBIOS_vsync)(this);
#endif

XBIOS_fbnum = 0;
XBIOS_current = new_video_mode;

this->UpdateRects = XBIOS_updRects;

return (current);
Expand Down

0 comments on commit 3a0c3a4

Please sign in to comment.