From d19329e574fff41ec8cd85d843c6f6ddeac75e61 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Wed, 1 Apr 2026 10:34:06 -0400
Subject: [PATCH] video: Rebuild screen surface in SDL_SetVideoMode when the
window survives.
Fixes #391.
---
src/SDL12_compat.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index f90529335..6627e1cd3 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -6565,6 +6565,8 @@ SetVideoModeImpl(int width, int height, int bpp, Uint32 flags12)
if (recreate_window) {
EndVidModeCreate(); /* rebuild the window if we can't resize it. */
+ } else if (!VideoSurface12->format || (VideoSurface12->format->BitsPerPixel != bpp)) {
+ FreeSurfaceContents(VideoSurface12); /* hollow out the 1.2 surface if the fomat changes, even if the window survives...so palettes, etc, get recreated. */
}
}