From 0af491c1e16b631a93ed393d30bd41e9382cdb59 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Tue, 21 Jan 2025 22:25:02 -0500
Subject: [PATCH] Surface2to3: Need to set surface w and h if changed, not
assert.
sdl12-compat creates the video surface with 0x0 dimensions until it gets
further through initialization, and sdl2-compat and SDL3 need to catch
up with their internal state later.
---
src/sdl2_compat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 7327b89..fb007e3 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -2753,8 +2753,8 @@ static SDL_Surface *Surface2to3(SDL2_Surface *surface)
* The application might have changed memory allocation, e.g.:
* https://github.com/libsdl-org/SDL_ttf/blob/7e4a456bf463b887b94c191030dd742d7654d6ff/SDL_ttf.c#L1476-L1478
*/
- SDL_assert(surface->w == surface3->w);
- SDL_assert(surface->h == surface3->h);
+ surface3->w = surface->w;
+ surface3->h = surface->h;
surface3->flags &= ~(surface->flags & SHARED_SURFACE_FLAGS);
surface3->flags |= (surface->flags & SHARED_SURFACE_FLAGS);
surface3->pixels = surface->pixels;