From a29ef93e2ac7b8912cb38bc62dd40f62d7dcb52c Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 3 Feb 2025 08:20:15 -0800
Subject: [PATCH] Revert change to use SDL_SoftStretch() until SDL 3.2.4
We may be releasing further updates to sdl2-compat before then.
Reopens https://github.com/libsdl-org/sdl2-compat/issues/251
---
src/sdl2_compat.c | 6 +++---
src/sdl3_include_wrapper.h | 10 +++++-----
src/sdl3_syms.h | 1 -
3 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index c425b4e..d4cef01 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -318,7 +318,7 @@ static char loaderror[256];
#endif
#ifndef SDL3_REQUIRED_VER
-#define SDL3_REQUIRED_VER SDL_VERSIONNUM(3,2,3)
+#define SDL3_REQUIRED_VER SDL_VERSIONNUM(3,2,0)
#endif
#ifndef DIRSEP
@@ -3423,13 +3423,13 @@ SDL_LowerBlitScaled(SDL2_Surface *src2, SDL_Rect *srcrect, SDL2_Surface *dst2, S
SDL_DECLSPEC int SDLCALL
SDL_SoftStretch(SDL2_Surface *src, const SDL_Rect *srcrect, SDL2_Surface *dst, const SDL_Rect *dstrect)
{
- return SDL3_SoftStretch(Surface2to3(src), srcrect, Surface2to3(dst), dstrect, SDL_SCALEMODE_NEAREST) ? 0 : -1;
+ return SDL3_BlitSurfaceScaled(Surface2to3(src), srcrect, Surface2to3(dst), dstrect, SDL_SCALEMODE_NEAREST) ? 0 : -1;
}
SDL_DECLSPEC int SDLCALL
SDL_SoftStretchLinear(SDL2_Surface *src, const SDL_Rect *srcrect, SDL2_Surface *dst, const SDL_Rect *dstrect)
{
- return SDL3_SoftStretch(Surface2to3(src), srcrect, Surface2to3(dst), dstrect, SDL_SCALEMODE_LINEAR) ? 0 : -1;
+ return SDL3_BlitSurfaceScaled(Surface2to3(src), srcrect, Surface2to3(dst), dstrect, SDL_SCALEMODE_LINEAR) ? 0 : -1;
}
/* SDL_GetTicks is 64-bit in SDL3. Clamp it for SDL2. */
diff --git a/src/sdl3_include_wrapper.h b/src/sdl3_include_wrapper.h
index 1abe70f..37b13cf 100644
--- a/src/sdl3_include_wrapper.h
+++ b/src/sdl3_include_wrapper.h
@@ -1265,7 +1265,7 @@
#define SDL_AudioStreamDevicePaused IGNORE_THIS_VERSION_OF_SDL_AudioStreamDevicePaused
#define SDL_ClickTrayEntry IGNORE_THIS_VERSION_OF_SDL_ClickTrayEntry
#define SDL_UpdateTrays IGNORE_THIS_VERSION_OF_SDL_UpdateTrays
-#define SDL_SoftStretch IGNORE_THIS_VERSION_OF_SDL_SoftStretch
+#define SDL_StretchSurface IGNORE_THIS_VERSION_OF_SDL_StretchSurface
#define SDL_FUNCTION_POINTER_IS_VOID_POINTER 1
@@ -1273,8 +1273,8 @@
#define __BUILDING_SDL2_COMPAT__ 1
#include <SDL3/SDL.h>
-#if !SDL_VERSION_ATLEAST(3,2,3)
-#error You need to compile against SDL >= 3.2.3 headers
+#if !SDL_VERSION_ATLEAST(3,2,0)
+#error You need to compile against SDL >= 3.2.0 headers
#endif
#define SDL_MAIN_HANDLED 1
@@ -6218,8 +6218,8 @@
#undef SDL_UpdateTrays
#endif
-#ifdef SDL_SoftStretch
-#undef SDL_SoftStretch
+#ifdef SDL_StretchSurface
+#undef SDL_StretchSurface
#endif
#undef SDL_ThreadID /* see at top. */
diff --git a/src/sdl3_syms.h b/src/sdl3_syms.h
index 498fc58..29a8e7a 100644
--- a/src/sdl3_syms.h
+++ b/src/sdl3_syms.h
@@ -671,7 +671,6 @@ SDL3_SYM(bool,ShowWindow,(SDL_Window *a),(a),return)
SDL3_SYM(void,SignalCondition,(SDL_Condition *a),(a),return)
SDL3_SYM(void,SignalSemaphore,(SDL_Semaphore *a),(a),return)
SDL3_SYM(bool,StartTextInput,(SDL_Window *a),(a),return)
-SDL3_SYM(bool,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(bool,StartTextInputWithProperties,(SDL_Window *a, SDL_PropertiesID b),(a,b),return)
SDL3_SYM(bool,StopTextInput,(SDL_Window *a),(a),return)
SDL3_SYM(bool,SurfaceHasColorKey,(SDL_Surface *a),(a),return)