sdl2-compat: Add SDL_SoftStretchLinear() and SDL_SoftStretch()

From 41f645b5f9c00af6a5590063e1915d7ffe3c8a69 Mon Sep 17 00:00:00 2001
From: Sylvain <[EMAIL REDACTED]>
Date: Fri, 22 Dec 2023 15:05:39 +0100
Subject: [PATCH] Add SDL_SoftStretchLinear() and SDL_SoftStretch()

---
 src/sdl2_compat.c          | 12 ++++++++++++
 src/sdl3_include_wrapper.h |  5 -----
 src/sdl3_syms.h            |  3 +--
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 74408fa..7c67d6c 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -2544,6 +2544,18 @@ SDL_UpperBlitScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst,
     return SDL3_BlitSurfaceScaled(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST);
 }
 
+DECLSPEC int SDLCALL
+SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect)
+{
+    return SDL3_SoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST);
+}
+
+DECLSPEC int SDLCALL
+SDL_SoftStretchLinear(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect)
+{
+    return SDL3_SoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_LINEAR);
+}
+
 /* SDL_GetTicks is 64-bit in SDL3. Clamp it for SDL2. */
 DECLSPEC Uint32 SDLCALL
 SDL_GetTicks(void)
diff --git a/src/sdl3_include_wrapper.h b/src/sdl3_include_wrapper.h
index e449046..dfed32e 100644
--- a/src/sdl3_include_wrapper.h
+++ b/src/sdl3_include_wrapper.h
@@ -638,7 +638,6 @@
 #define SDL_ShowWindow IGNORE_THIS_VERSION_OF_SDL_ShowWindow
 #define SDL_SignalCondition IGNORE_THIS_VERSION_OF_SDL_SignalCondition
 #define SDL_SoftStretch IGNORE_THIS_VERSION_OF_SDL_SoftStretch
-#define SDL_SoftStretchLinear IGNORE_THIS_VERSION_OF_SDL_SoftStretchLinear
 #define SDL_StartTextInput IGNORE_THIS_VERSION_OF_SDL_StartTextInput
 #define SDL_StopTextInput IGNORE_THIS_VERSION_OF_SDL_StopTextInput
 #define SDL_SurfaceHasColorKey IGNORE_THIS_VERSION_OF_SDL_SurfaceHasColorKey
@@ -3457,10 +3456,6 @@
 #undef SDL_SoftStretch
 #endif
 
-#ifdef SDL_SoftStretchLinear
-#undef SDL_SoftStretchLinear
-#endif
-
 #ifdef SDL_StartTextInput
 #undef SDL_StartTextInput
 #endif
diff --git a/src/sdl3_syms.h b/src/sdl3_syms.h
index afe7b1f..e64e778 100644
--- a/src/sdl3_syms.h
+++ b/src/sdl3_syms.h
@@ -446,7 +446,7 @@ SDL3_SYM_RENAMED(int,FillRect,FillSurfaceRect,(SDL_Surface *a, const SDL_Rect *b
 SDL3_SYM_RENAMED(int,FillRects,FillSurfaceRects,(SDL_Surface *a, const SDL_Rect *b, int c, Uint32 d),(a,b,c,d),return)
 SDL3_SYM_RENAMED(int,UpperBlit,BlitSurface,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return)
 SDL3_SYM(int,BlitSurfaceUnchecked,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d),(a,b,c,d),return)
-SDL3_SYM_PASSTHROUGH(int,SoftStretch,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d),(a,b,c,d),return)
+SDL3_SYM(int,SoftStretch,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d, SDL_ScaleMode e),(a,b,c,d,e),return)
 SDL3_SYM(int,BlitSurfaceScaled,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, SDL_Rect *d, SDL_ScaleMode e),(a,b,c,d,e),return)
 SDL3_SYM(int,BlitSurfaceUncheckedScaled,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d, SDL_ScaleMode e),(a,b,c,d,e),return)
 SDL3_SYM_PASSTHROUGH(const char*,GetThreadName,(SDL_Thread *a),(a),return)
@@ -692,7 +692,6 @@ SDL3_SYM_PASSTHROUGH(double,round,(double a),(a),return)
 SDL3_SYM_PASSTHROUGH(float,roundf,(float a),(a),return)
 SDL3_SYM_PASSTHROUGH(long,lround,(double a),(a),return)
 SDL3_SYM_PASSTHROUGH(long,lroundf,(float a),(a),return)
-SDL3_SYM_PASSTHROUGH(int,SoftStretchLinear,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d),(a,b,c,d),return)
 SDL3_SYM_PASSTHROUGH(int,UpdateNVTexture,(SDL_Texture *a, const SDL_Rect *b, const Uint8 *c, int d, const Uint8 *e, int f),(a,b,c,d,e,f),return)
 SDL3_SYM(int,SetWindowKeyboardGrab,(SDL_Window *a, SDL_bool b),(a,b),return)
 SDL3_SYM(int,SetWindowMouseGrab,(SDL_Window *a, SDL_bool b),(a,b),return)