SDL: Use the surface palette when creating a texture from a surface

From c8d08ea2dfd5eb854407124e7fe420d2fe98cfbe Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 1 Sep 2026 16:38:16 -0700
Subject: [PATCH] Use the surface palette when creating a texture from a
 surface

Fixes https://github.com/libsdl-org/SDL/issues/16227
---
 src/render/SDL_render.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index 445f14c62aa4c..8b8a5487f251c 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -1885,6 +1885,7 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
     SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER, SDL_TEXTUREACCESS_STATIC);
     SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER, surface->w);
     SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER, surface->h);
+    SDL_SetPointerProperty(props, SDL_PROP_TEXTURE_CREATE_PALETTE_POINTER, surface->palette);
 
     texture = SDL_CreateTextureWithProperties(renderer, props);
     SDL_DestroyProperties(props);