From ee52fdafaadfaf8c2f7030dbac7761db203a4cba Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Mon, 1 Mar 2021 21:00:10 +0300
Subject: [PATCH] implemented SDL_SoftStretch()
Closes: https://github.com/libsdl-org/sdl12-compat/issues/30
---
src/SDL12_compat.c | 10 ++++++++++
src/SDL20_include_wrapper.h | 2 ++
src/SDL20_syms.h | 1 +
3 files changed, 13 insertions(+)
diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 7bd1e62..9ca3089 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -3366,6 +3366,16 @@ SDL_LowerBlit(SDL12_Surface *src12, SDL12_Rect *srcrect12, SDL12_Surface *dst12,
return retval;
}
+DECLSPEC int SDLCALL
+SDL_SoftStretch(SDL12_Surface *src12, SDL12_Rect *srcrect12, SDL12_Surface *dst12, SDL12_Rect *dstrect12)
+{
+ SDL_Rect srcrect20, dstrect20;
+ return SDL20_SoftStretch(src12->surface20,
+ srcrect12 ? Rect12to20(srcrect12, &srcrect20) : NULL,
+ dst12->surface20,
+ dstrect12 ? Rect12to20(dstrect12, &dstrect20) : NULL);
+}
+
DECLSPEC int SDLCALL
SDL_SetAlpha(SDL12_Surface *surface12, Uint32 flags12, Uint8 value)
{
diff --git a/src/SDL20_include_wrapper.h b/src/SDL20_include_wrapper.h
index b3816a7..7098a39 100644
--- a/src/SDL20_include_wrapper.h
+++ b/src/SDL20_include_wrapper.h
@@ -88,6 +88,7 @@
#define SDL_LoadWAV_RW IGNORE_THIS_VERSION_OF_SDL_LoadWAV_RW
#define SDL_UpperBlit IGNORE_THIS_VERSION_OF_SDL_UpperBlit
#define SDL_LowerBlit IGNORE_THIS_VERSION_OF_SDL_LowerBlit
+#define SDL_SoftStretch IGNORE_THIS_VERSION_OF_SDL_SoftStretch
#define SDL_ConvertSurface IGNORE_THIS_VERSION_OF_SDL_ConvertSurface
#define SDL_SetColorKey IGNORE_THIS_VERSION_OF_SDL_SetColorKey
#define SDL_LockSurface IGNORE_THIS_VERSION_OF_SDL_LockSurface
@@ -191,6 +192,7 @@ typedef void (__cdecl *pfnSDL_CurrentEndThread) (unsigned);
#undef SDL_LoadWAV_RW
#undef SDL_UpperBlit
#undef SDL_LowerBlit
+#undef SDL_SoftStretch
#undef SDL_ConvertSurface
#undef SDL_SetColorKey
#undef SDL_LockSurface
diff --git a/src/SDL20_syms.h b/src/SDL20_syms.h
index 92aec50..4d76b49 100644
--- a/src/SDL20_syms.h
+++ b/src/SDL20_syms.h
@@ -96,6 +96,7 @@ SDL20_SYM(int,LockSurface,(SDL_Surface *a),(a),return)
SDL20_SYM(void,UnlockSurface,(SDL_Surface *a),(a),)
SDL20_SYM(int,UpperBlit,(SDL_Surface *a,const SDL_Rect *b,SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return)
SDL20_SYM(int,LowerBlit,(SDL_Surface *a,const SDL_Rect *b,SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return)
+SDL20_SYM(int,SoftStretch,(SDL_Surface *a,const SDL_Rect *b,SDL_Surface *c,const SDL_Rect *d),(a,b,c,d),return)
SDL20_SYM(SDL_bool,HasColorKey,(SDL_Surface *a),(a),return)
SDL20_SYM(int,SetColorKey,(SDL_Surface *a, int b, Uint32 c),(a,b,c),return)
SDL20_SYM(int,GetColorKey,(SDL_Surface *a, Uint32 *b),(a,b),return)