Skip to content

Commit 9752347

Browse files
committed
Use SDL_StretchSurface() to implement SDL_SoftStretch() and SDL_SoftStretchLinear()
Fixes #251
1 parent 494af49 commit 9752347

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/sdl2_compat.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ static char loaderror[256];
398398
#endif
399399

400400
#ifndef SDL3_REQUIRED_VER
401-
#define SDL3_REQUIRED_VER SDL_VERSIONNUM(3,2,0)
401+
#define SDL3_REQUIRED_VER SDL_VERSIONNUM(3,2,4)
402402
#endif
403403

404404
#ifndef DIRSEP
@@ -3635,13 +3635,13 @@ SDL_LowerBlitScaled(SDL2_Surface *src2, SDL_Rect *srcrect, SDL2_Surface *dst2, S
36353635
SDL_DECLSPEC int SDLCALL
36363636
SDL_SoftStretch(SDL2_Surface *src, const SDL_Rect *srcrect, SDL2_Surface *dst, const SDL_Rect *dstrect)
36373637
{
3638-
return SDL3_BlitSurfaceScaled(Surface2to3(src), srcrect, Surface2to3(dst), dstrect, SDL_SCALEMODE_NEAREST) ? 0 : -1;
3638+
return SDL3_StretchSurface(Surface2to3(src), srcrect, Surface2to3(dst), dstrect, SDL_SCALEMODE_NEAREST) ? 0 : -1;
36393639
}
36403640

36413641
SDL_DECLSPEC int SDLCALL
36423642
SDL_SoftStretchLinear(SDL2_Surface *src, const SDL_Rect *srcrect, SDL2_Surface *dst, const SDL_Rect *dstrect)
36433643
{
3644-
return SDL3_BlitSurfaceScaled(Surface2to3(src), srcrect, Surface2to3(dst), dstrect, SDL_SCALEMODE_LINEAR) ? 0 : -1;
3644+
return SDL3_StretchSurface(Surface2to3(src), srcrect, Surface2to3(dst), dstrect, SDL_SCALEMODE_LINEAR) ? 0 : -1;
36453645
}
36463646

36473647
/* SDL_GetTicks is 64-bit in SDL3. Clamp it for SDL2. */

src/sdl3_include_wrapper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,8 +1273,8 @@
12731273
#define __BUILDING_SDL2_COMPAT__ 1
12741274

12751275
#include <SDL3/SDL.h>
1276-
#if !SDL_VERSION_ATLEAST(3,2,0)
1277-
#error You need to compile against SDL >= 3.2.0 headers
1276+
#if !SDL_VERSION_ATLEAST(3,2,4)
1277+
#error You need to compile against SDL >= 3.2.4 headers
12781278
#endif
12791279

12801280
#define SDL_MAIN_HANDLED 1

src/sdl3_syms.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,7 @@ SDL3_SYM(void,SignalSemaphore,(SDL_Semaphore *a),(a),return)
676676
SDL3_SYM(bool,StartTextInput,(SDL_Window *a),(a),return)
677677
SDL3_SYM(bool,StartTextInputWithProperties,(SDL_Window *a, SDL_PropertiesID b),(a,b),return)
678678
SDL3_SYM(bool,StopTextInput,(SDL_Window *a),(a),return)
679+
SDL3_SYM(bool,StretchSurface,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d, SDL_ScaleMode e),(a,b,c,d,e),return)
679680
SDL3_SYM(bool,SurfaceHasColorKey,(SDL_Surface *a),(a),return)
680681
SDL3_SYM(bool,SurfaceHasRLE,(SDL_Surface *a),(a),return)
681682
SDL3_SYM_RENAMED(void,TLSCleanup,CleanupTLS,(void),(),)

0 commit comments

Comments
 (0)