Bläddra i källkod

Use the surface palette when creating a texture from a surface

Fixes https://github.com/libsdl-org/SDL/issues/16227
Sam Lantinga 2 veckor sedan
förälder
incheckning
c8d08ea2df
1 ändrade filer med 1 tillägg och 0 borttagningar
  1. 1 0
      src/render/SDL_render.c

+ 1 - 0
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);