sdl2-compat: Updated for latest SDL3 API changes

From 5492a3959d537d931dae27ea6afe9e8963fcb1fe Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 24 Feb 2024 21:12:54 -0800
Subject: [PATCH] Updated for latest SDL3 API changes

---
 src/sdl2_compat.c          | 10 ++++++++--
 src/sdl3_include_wrapper.h |  5 -----
 src/sdl3_syms.h            |  4 ++--
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 71b799f..1ea2e9a 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -508,6 +508,12 @@ SDL_DelHintCallback(const char *name, SDL_HintCallback callback, void *userdata)
     SDL3_DelHintCallback(SDL2_to_SDL3_hint(name), callback, userdata);
 }
 
+DECLSPEC void SDLCALL
+SDL_ClearHints(void)
+{
+    SDL3_ResetHints();
+}
+
 static void
 SDL2Compat_ApplyQuirks(SDL_bool force_x11)
 {
@@ -2645,7 +2651,7 @@ SDL_ConvertPixels(int width, int height, Uint32 src_format, const void *src, int
 {
     SDL_Colorspace src_colorspace = GetColorspaceForFormatAndSize(src_format, width, height);
     SDL_Colorspace dst_colorspace = GetColorspaceForFormatAndSize(dst_format, width, height);
-    return SDL3_ConvertPixelsAndColorspace(width, height, src_format, src_colorspace, src, src_pitch, dst_format, dst_colorspace, dst, dst_pitch);
+    return SDL3_ConvertPixelsAndColorspace(width, height, src_format, src_colorspace, 0, src, src_pitch, dst_format, dst_colorspace, 0, dst, dst_pitch);
 }
 
 DECLSPEC SDL_Surface * SDLCALL
@@ -4282,7 +4288,7 @@ SDL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, Uint32 form
     }
 
     if (SDL3_GetSurfaceColorspace(surface, &surface_colorspace) == 0 &&
-        SDL3_ConvertPixelsAndColorspace(surface->w, surface->h, surface->format->format, surface_colorspace,  surface->pixels, surface->pitch, format, SDL_COLORSPACE_SRGB, pixels, pitch) == 0) {
+        SDL3_ConvertPixelsAndColorspace(surface->w, surface->h, surface->format->format, surface_colorspace, SDL3_GetSurfaceProperties(surface), surface->pixels, surface->pitch, format, SDL_COLORSPACE_SRGB, 0, pixels, pitch) == 0 ) {
         result = 0;
     }
 
diff --git a/src/sdl3_include_wrapper.h b/src/sdl3_include_wrapper.h
index 326e105..bcdac85 100644
--- a/src/sdl3_include_wrapper.h
+++ b/src/sdl3_include_wrapper.h
@@ -69,7 +69,6 @@
 #define SDL_CleanupTLS IGNORE_THIS_VERSION_OF_SDL_CleanupTLS
 #define SDL_ClearComposition IGNORE_THIS_VERSION_OF_SDL_ClearComposition
 #define SDL_ClearError IGNORE_THIS_VERSION_OF_SDL_ClearError
-#define SDL_ClearHints IGNORE_THIS_VERSION_OF_SDL_ClearHints
 #define SDL_CloseGamepad IGNORE_THIS_VERSION_OF_SDL_CloseGamepad
 #define SDL_CloseJoystick IGNORE_THIS_VERSION_OF_SDL_CloseJoystick
 #define SDL_CloseSensor IGNORE_THIS_VERSION_OF_SDL_CloseSensor
@@ -1171,10 +1170,6 @@
 #undef SDL_ClearError
 #endif
 
-#ifdef SDL_ClearHints
-#undef SDL_ClearHints
-#endif
-
 #ifdef SDL_CloseGamepad
 #undef SDL_CloseGamepad
 #endif
diff --git a/src/sdl3_syms.h b/src/sdl3_syms.h
index 19325a3..ba8c492 100644
--- a/src/sdl3_syms.h
+++ b/src/sdl3_syms.h
@@ -206,7 +206,6 @@ SDL3_SYM(SDL_bool,SetHint,(const char *a, const char *b),(a,b),return)
 SDL3_SYM(const char*,GetHint,(const char *a),(a),return)
 SDL3_SYM(int,AddHintCallback,(const char *a, SDL_HintCallback b, void *c),(a,b,c),)
 SDL3_SYM(void,DelHintCallback,(const char *a, SDL_HintCallback b, void *c),(a,b,c),)
-SDL3_SYM_PASSTHROUGH(void,ClearHints,(void),(),)
 SDL3_SYM_RENAMED(const char*,JoystickName,GetJoystickName,(SDL_Joystick *a),(a),return)
 SDL3_SYM_RENAMED(SDL_JoystickGUID,JoystickGetGUID,GetJoystickGUID,(SDL_Joystick *a),(a),return)
 SDL3_SYM(int,GetJoystickGUIDString,(SDL_JoystickGUID a, char *b, int c),(a,b,c),return)
@@ -435,7 +434,7 @@ SDL3_SYM(int,GetSurfaceClipRect,(SDL_Surface *a, SDL_Rect *b),(a,b),return)
 SDL3_SYM(int,ConvertEventToRenderCoordinates,(SDL_Renderer *a, SDL_Event *b),(a,b),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(int,ConvertPixelsAndColorspace,(int a, int b, Uint32 c, SDL_Colorspace d, const void *e, int f, Uint32 g, SDL_Colorspace h, void *i, int j),(a,b,c,d,e,f,g,h,i,j),return)
+SDL3_SYM(int,ConvertPixelsAndColorspace,(int a, int b, Uint32 c, SDL_Colorspace d, SDL_PropertiesID e, const void *f, int g, Uint32 h, SDL_Colorspace i, SDL_PropertiesID j, void *k, int l),(a,b,c,d,e,f,g,h,i,j,k,l),return)
 SDL3_SYM_RENAMED(int,FillRect,FillSurfaceRect,(SDL_Surface *a, const SDL_Rect *b, Uint32 c),(a,b,c),return)
 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)
@@ -860,6 +859,7 @@ SDL3_SYM(SDL_PropertiesID,GetJoystickProperties,(SDL_Joystick *a),(a),return)
 SDL3_SYM(SDL_PropertiesID,GetGamepadProperties,(SDL_GameController *a),(a),return)
 SDL3_SYM(int,GetSurfaceColorspace,(SDL_Surface *a, SDL_Colorspace *b),(a,b),return)
 SDL3_SYM(int,SetWindowShape,(SDL_Window *a, SDL_Surface *b),(a,b),return)
+SDL3_SYM(SDL_PropertiesID,GetSurfaceProperties,(SDL_Surface *a),(a),return)
 
 #undef SDL3_SYM
 #undef SDL3_SYM_PASSTHROUGH