mirror of https://github.com/encounter/SDL.git
SDL_windowsevents: minimize white screen flash on window creation
Clear the window to black on the initial window draw, to avoid a really obnoxious white flash. This doesn't always eliminate it, but it definitely minimizes it.
This commit is contained in:
parent
b6e7c743db
commit
053b5f85f1
|
@ -1271,7 +1271,15 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
/* We'll do our own drawing, prevent flicker */
|
||||
case WM_ERASEBKGND:
|
||||
if (!data->videodata->cleared)
|
||||
{
|
||||
RECT client_rect;
|
||||
HBRUSH brush;
|
||||
data->videodata->cleared = SDL_TRUE;
|
||||
GetClientRect(hwnd, &client_rect);
|
||||
brush = CreateSolidBrush(0);
|
||||
FillRect(GetDC(hwnd), &client_rect, brush);
|
||||
DeleteObject(brush);
|
||||
}
|
||||
return (1);
|
||||
|
||||
|
|
|
@ -394,6 +394,7 @@ typedef struct SDL_VideoData
|
|||
#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
|
||||
|
||||
SDL_bool dpi_scaling_enabled;
|
||||
SDL_bool cleared;
|
||||
|
||||
#ifndef SDL_DISABLE_WINDOWS_IME
|
||||
SDL_bool ime_com_initialized;
|
||||
|
|
Loading…
Reference in New Issue