window: ignore nonpositive resize dimensions

This commit is contained in:
nmzik 2026-10-03 17:54:06 +02:00
parent ab98fb1ff9
commit 0e8ded37b9
2 changed files with 7 additions and 5 deletions

View File

@ -362,11 +362,13 @@ static void GameEventDidEnterForeground(WindowLoopState& game) {
SetPause(game, false);
}
void WindowContext::Resize(uint32_t new_width, uint32_t new_height) {
EXIT_IF(new_width == 0 || new_height == 0);
void WindowContext::Resize(int new_width, int new_height) {
if (new_width <= 0 || new_height <= 0) {
return;
}
Common::LockGuard lock(mutex);
graphic_ctx.screen_width = new_width;
graphic_ctx.screen_height = new_height;
graphic_ctx.screen_width = static_cast<uint32_t>(new_width);
graphic_ctx.screen_height = static_cast<uint32_t>(new_height);
}
void WindowContext::ProcessWindowEvent(const SDL_WindowEvent& event) {

View File

@ -42,7 +42,7 @@ struct WindowContext {
void RefreshSurfaceCapabilities();
void UpdateIcon();
void UpdateTitle();
void Resize(uint32_t width, uint32_t height);
void Resize(int width, int height);
void ProcessWindowEvent(const SDL_WindowEvent& event);
void ProcessDisplayEvent(const SDL_DisplayEvent& event);
void ProcessEvent(double time_seconds);