SDL_image: svg: Fix channel order on big-endian platforms

From 7c954d41f8fc78c61c13c4888fe523d8b8e2ead7 Mon Sep 17 00:00:00 2001
From: Simon McVittie <[EMAIL REDACTED]>
Date: Wed, 25 May 2022 13:45:03 +0100
Subject: [PATCH] svg: Fix channel order on big-endian platforms

nanosvg always decodes the red channel of the first pixel into the first
byte of the buffer, regardless of whether interpreting the buffer as
a sequence of 32-bit words would consider that to be the most or least
significant byte of the first word. In SDL terminology that's
SDL_PIXELFORMAT_RGBA32.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 IMG_svg.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/IMG_svg.c b/IMG_svg.c
index a93d6d9a..e834c7db 100644
--- a/IMG_svg.c
+++ b/IMG_svg.c
@@ -137,14 +137,12 @@ SDL_Surface *IMG_LoadSizedSVG_RW(SDL_RWops *src, int width, int height)
         scale = 1.0f;
     }
 
-    surface = SDL_CreateRGBSurface(SDL_SWSURFACE,
-                                   (int)SDL_ceilf(image->width * scale),
-                                   (int)SDL_ceilf(image->height * scale),
-                                   32,
-                                   0x000000FF,
-                                   0x0000FF00,
-                                   0x00FF0000,
-                                   0xFF000000);
+    surface = SDL_CreateRGBSurfaceWithFormat(0,
+                                             (int)SDL_ceilf(image->width * scale),
+                                             (int)SDL_ceilf(image->height * scale),
+                                             32,
+                                             SDL_PIXELFORMAT_RGBA32);
+
     if (!surface) {
         nsvgDeleteRasterizer(rasterizer);
         nsvgDelete(image);