Fixed changing palettes while rendering is in flight

This commit is contained in:
Sam Lantinga
2025-09-27 09:45:03 -07:00
parent 0b4b254a53
commit 264b436dba
4 changed files with 152 additions and 26 deletions

View File

@@ -1896,6 +1896,17 @@ bool SDL_SetTexturePalette(SDL_Texture *texture, SDL_Palette *palette)
}
if (palette != texture->palette) {
if (!FlushRenderCommandsIfTextureNeeded(texture)) {
return false;
}
if (!texture->native) {
SDL_Renderer *renderer = texture->renderer;
if (!renderer->ChangeTexturePalette(renderer, texture, palette)) {
return false;
}
}
if (texture->palette) {
SDL_DestroyPalette(texture->palette);
}