SDL_image: Use 32x32 as the primary surface for cursors where possible

From a163ab464b3cc272dc407b683665f9e76ed58c19 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 21 Oct 2025 09:34:12 -0700
Subject: [PATCH] Use 32x32 as the primary surface for cursors where possible

Windows defaults to 32x32 pixel cursors, adjusting for DPI scale, so use that as the primary surface, if available.
---
 src/IMG_bmp.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/IMG_bmp.c b/src/IMG_bmp.c
index 6fecc069..fb5f0c7b 100644
--- a/src/IMG_bmp.c
+++ b/src/IMG_bmp.c
@@ -623,6 +623,11 @@ static SDL_Surface *LoadICOCUR_IO(SDL_IOStream *src, int type, bool closeio)
         if (i == 0) {
             surface = entry->surface;
             ++surface->refcount;
+        } else if (type == ICON_TYPE_CUR && entry->surface->w == 32 && entry->surface->h == 32) {
+            // Windows defaults to 32x32 pixel cursors, adjusting for DPI scale, so use that as the primary surface
+            --surface->refcount;
+            surface = entry->surface;
+            ++surface->refcount;
         }
     }
     for (i = 0; i < entries.num_entries; ++i) {