1
0
Fork 0
forked from len0rd/rockbox

sdl: fix: concurrent drawing on Windows

On Windows, we need to prevent the event thread
from drawing at the same time as the main thread,
when window is being adjusted.

Change-Id: I2b4e4a50fec427e53e310593850e2a556a594b31
This commit is contained in:
Christian Soffke 2024-12-26 12:11:55 +01:00
parent 0a88b818e9
commit fa8b095f29
5 changed files with 18 additions and 0 deletions

View file

@ -102,6 +102,9 @@ void sdl_gui_update(SDL_Surface *surface, int x_start, int y_start, int width,
SDL_Rect dest= {ui_x + x_start, ui_y + y_start, width, height};
uint8_t alpha;
SDL_LockMutex(window_mutex);
if (SDL_GetSurfaceAlphaMod(surface,&alpha) == 0 && alpha < 255)
SDL_FillRect(sim_lcd_surface, NULL, 0); /* alpha needs a black background */
@ -111,6 +114,7 @@ void sdl_gui_update(SDL_Surface *surface, int x_start, int y_start, int width,
if (!sdl_window_adjust()) /* already calls sdl_window_render itself */
sdl_window_render();
SDL_UnlockMutex(window_mutex);
}
/* set a range of bitmap indices to a gradient from startcolour to endcolour */