sdl2-compat: Implement SDL surface API changes.

From 97fa70858990ae30fdbba53e01b94b4ececf5f38 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Tue, 29 Nov 2022 21:28:50 -0500
Subject: [PATCH] Implement SDL surface API changes.

- Removed unused 'depth' parameter from SDL_CreateRGBSurfaceWithFormat() and SDL_CreateRGBSurfaceWithFormatFrom()
- Removed unused 'flags' parameter from SDL_CreateRGBSurface() and SDL_CreateRGBSurfaceWithFormat()
- Removed unused 'flags' parameter from SDL_ConvertSurface and SDL_ConvertSurfaceFormat
---
 src/sdl2_compat.c | 36 ++++++++++++++++++++++++++++++++++++
 src/sdl3_syms.h   | 10 +++++-----
 2 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index c372156..74daa81 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -816,6 +816,42 @@ SDL_GetWindowGammaRamp(SDL_Window *window, Uint16 *red, Uint16 *blue, Uint16 *gr
     return 0;
 }
 
+DECLSPEC SDL_Surface * SDLCALL
+SDL_ConvertSurface(SDL_Surface *src, const SDL_PixelFormat *fmt, Uint32 flags)
+{
+    (void) flags; /* SDL3 removed the (unused) `flags` argument */
+    return SDL3_ConvertSurface(src, fmt);
+}
+
+DECLSPEC SDL_Surface * SDLCALL
+SDL_ConvertSurfaceFormat(SDL_Surface * src, Uint32 pixel_format, Uint32 flags)
+{
+    (void) flags; /* SDL3 removed the (unused) `flags` argument */
+    return SDL3_ConvertSurfaceFormat(src, pixel_format);
+}
+
+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);
+}
+
+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);
+}
+
+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);
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/sdl3_syms.h b/src/sdl3_syms.h
index f68b49a..26a6f81 100644
--- a/src/sdl3_syms.h
+++ b/src/sdl3_syms.h
@@ -461,7 +461,7 @@ 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_PASSTHROUGH(SDL_Surface*,CreateRGBSurface,(Uint32 a, int b, int c, int d, Uint32 e, Uint32 f, Uint32 g, Uint32 h),(a,b,c,d,e,f,g,h),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_PASSTHROUGH(void,FreeSurface,(SDL_Surface *a),(a),)
 SDL3_SYM_PASSTHROUGH(int,SetSurfacePalette,(SDL_Surface *a, SDL_Palette *b),(a,b),return)
@@ -480,8 +480,8 @@ SDL3_SYM_PASSTHROUGH(int,SetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode b),(
 SDL3_SYM_PASSTHROUGH(int,GetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode *b),(a,b),return)
 SDL3_SYM_PASSTHROUGH(SDL_bool,SetClipRect,(SDL_Surface *a, const SDL_Rect *b),(a,b),return)
 SDL3_SYM_PASSTHROUGH(void,GetClipRect,(SDL_Surface *a, SDL_Rect *b),(a,b),)
-SDL3_SYM_PASSTHROUGH(SDL_Surface*,ConvertSurface,(SDL_Surface *a, const SDL_PixelFormat *b, Uint32 c),(a,b,c),return)
-SDL3_SYM_PASSTHROUGH(SDL_Surface*,ConvertSurfaceFormat,(SDL_Surface *a, Uint32 b, Uint32 c),(a,b,c),return)
+SDL3_SYM(SDL_Surface*,ConvertSurface,(SDL_Surface *a, const SDL_PixelFormat *b),(a,b),return)
+SDL3_SYM(SDL_Surface*,ConvertSurfaceFormat,(SDL_Surface *a, Uint32 b),(a,b),return)
 SDL3_SYM_PASSTHROUGH(int,ConvertPixels,(int a, int b, Uint32 c, const void *d, int e, Uint32 f, void *g, int h),(a,b,c,d,e,f,g,h),return)
 SDL3_SYM_PASSTHROUGH(int,FillRect,(SDL_Surface *a, const SDL_Rect *b, Uint32 c),(a,b,c),return)
 SDL3_SYM_PASSTHROUGH(int,FillRects,(SDL_Surface *a, const SDL_Rect *b, int c, Uint32 d),(a,b,c,d),return)
@@ -623,8 +623,8 @@ SDL3_SYM_PASSTHROUGH(int,RenderSetIntegerScale,(SDL_Renderer *a, SDL_bool b),(a,
 SDL3_SYM_PASSTHROUGH(SDL_bool,RenderGetIntegerScale,(SDL_Renderer *a),(a),return)
 SDL3_SYM_PASSTHROUGH(Uint32,DequeueAudio,(SDL_AudioDeviceID a, void *b, Uint32 c),(a,b,c),return)
 SDL3_SYM_PASSTHROUGH(void,SetWindowResizable,(SDL_Window *a, SDL_bool b),(a,b),)
-SDL3_SYM_PASSTHROUGH(SDL_Surface*,CreateRGBSurfaceWithFormat,(Uint32 a, int b, int c, int d, Uint32 e),(a,b,c,d,e),return)
-SDL3_SYM_PASSTHROUGH(SDL_Surface*,CreateRGBSurfaceWithFormatFrom,(void *a, int b, int c, int d, int e, Uint32 f),(a,b,c,d,e,f),return)
+SDL3_SYM(SDL_Surface*,CreateRGBSurfaceWithFormat,(int a, int b, Uint32 c),(a,b,c),return)
+SDL3_SYM(SDL_Surface*,CreateRGBSurfaceWithFormatFrom,(void *a, int b, int c, int d, Uint32 e),(a,b,c,d,e),return)
 SDL3_SYM_PASSTHROUGH(SDL_bool,GetHintBoolean,(const char *a, SDL_bool b),(a,b),return)
 SDL3_SYM_PASSTHROUGH(Uint16,JoystickGetDeviceVendor,(int a),(a),return)
 SDL3_SYM_PASSTHROUGH(Uint16,JoystickGetDeviceProduct,(int a),(a),return)