sdl2-compat: Updated SDL_CreateRGBSurface* for new SDL3 functions

From 52422609e01ded387da3f8125e9768b60b78263a Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 1 Dec 2022 08:50:34 -0800
Subject: [PATCH] Updated SDL_CreateRGBSurface* for new SDL3 functions

---
 src/sdl2_compat.c | 18 +++++++++++-------
 src/sdl3_syms.h   |  4 ++--
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 0c3d4dd..b11cb54 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -835,23 +835,27 @@ SDL_ConvertSurfaceFormat(SDL_Surface * src, Uint32 pixel_format, Uint32 flags)
 DECLSPEC SDL_Surface * SDLCALL
 SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
 {
-    (void) flags; /* SDL3 removed the (unused) `flags` argument */
-    return SDL3_CreateRGBSurface(width, height, depth, Rmask, Gmask, Bmask, Amask);
+    return SDL3_CreateSurface(width, height,
+            SDL3_MasksToPixelFormatEnum(depth, Rmask, Gmask, Bmask, Amask));
 }
 
 DECLSPEC SDL_Surface * SDLCALL
 SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, Uint32 format)
 {
-    (void) flags; /* SDL3 removed the (unused) `flags` argument */
-    (void) depth; /* SDL3 removed the (unused) `depth` argument */
-    return SDL3_CreateRGBSurfaceWithFormat(width, height, format);
+    return SDL3_CreateSurface(width, height, format);
+}
+
+DECLSPEC SDL_Surface * SDLCALL
+SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
+{
+    return SDL3_CreateSurfaceFrom(pixels, width, height, pitch,
+            SDL3_MasksToPixelFormatEnum(depth, Rmask, Gmask, Bmask, Amask));
 }
 
 DECLSPEC SDL_Surface * SDLCALL
 SDL_CreateRGBSurfaceWithFormatFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 format)
 {
-    (void) depth; /* SDL3 removed the (unused) `depth` argument */
-    return SDL3_CreateRGBSurfaceWithFormatFrom(pixels, width, height, pitch, format);
+    return SDL3_CreateSurfaceFrom(pixels, width, height, pitch, format);
 }
 
 #ifdef __cplusplus
diff --git a/src/sdl3_syms.h b/src/sdl3_syms.h
index 26a6f81..f95e54d 100644
--- a/src/sdl3_syms.h
+++ b/src/sdl3_syms.h
@@ -461,8 +461,8 @@ SDL3_SYM_PASSTHROUGH(SDL_iconv_t,iconv_open,(const char *a, const char *b),(a,b)
 SDL3_SYM_PASSTHROUGH(int,iconv_close,(SDL_iconv_t a),(a),return)
 SDL3_SYM_PASSTHROUGH(size_t,iconv,(SDL_iconv_t a, const char **b, size_t *c, char **d, size_t *e),(a,b,c,d,e),return)
 SDL3_SYM_PASSTHROUGH(char*,iconv_string,(const char *a, const char *b, const char *c, size_t d),(a,b,c,d),return)
-SDL3_SYM(SDL_Surface*,CreateRGBSurface,(int a, int b, int c, Uint32 d, Uint32 e, Uint32 f, Uint32 g),(a,b,c,d,e,f,g),return)
-SDL3_SYM_PASSTHROUGH(SDL_Surface*,CreateRGBSurfaceFrom,(void *a, int b, int c, int d, int e, Uint32 f, Uint32 g, Uint32 h, Uint32 i),(a,b,c,d,e,f,g,h,i),return)
+SDL3_SYM(SDL_Surface*,CreateSurface,(int a, int b, Uint32 c),(a,b,c),return)
+SDL3_SYM(SDL_Surface*,CreateSurfaceFrom,(void *a, int b, int c, int d, Uint32 e),(a,b,c,d,e),return)
 SDL3_SYM_PASSTHROUGH(void,FreeSurface,(SDL_Surface *a),(a),)
 SDL3_SYM_PASSTHROUGH(int,SetSurfacePalette,(SDL_Surface *a, SDL_Palette *b),(a,b),return)
 SDL3_SYM_PASSTHROUGH(int,LockSurface,(SDL_Surface *a),(a),return)