SDL_image: Use SDL_roundf() where possible

From 4b7d166e5ce4dd5324a2a0c743712b476d1584ef Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 27 May 2022 08:26:05 -0700
Subject: [PATCH] Use SDL_roundf() where possible

---
 IMG_svg.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/IMG_svg.c b/IMG_svg.c
index 03f281d..6792c32 100644
--- a/IMG_svg.c
+++ b/IMG_svg.c
@@ -27,9 +27,13 @@
 
 #ifdef LOAD_SVG
 
-static float SDLCALL SDLIMAGE_roundf(float x) {
+#if !SDL_VERSION_ATLEAST(2, 0, 16)
+/* SDL_roundf() is available starting with 2.0.16 */
+static float SDLCALL SDL_roundf(float x)
+{
     return (x >= 0.0f) ? SDL_floorf(x + 0.5f) : SDL_ceilf(x - 0.5f);
 }
+#endif /* SDL 2.0.16 */
 
 /* Replace C runtime functions with SDL C runtime functions for building on Windows */
 #define free    SDL_free
@@ -67,7 +71,7 @@ static float SDLCALL SDLIMAGE_roundf(float x) {
 #define sqrt    SDL_sqrt
 #define sqrtf   SDL_sqrtf
 #define tanf    SDL_tanf
-#define roundf  SDLIMAGE_roundf
+#define roundf  SDL_roundf
 #ifndef FLT_MAX
 #define FLT_MAX     3.402823466e+38F
 #endif