Simplify palette code

Each texture gets its own palette, the palette is updated when it is rendered if necessary, rendering is flushed if a texture render is already queued up.

Trying to share palettes and handle the different cases of queued rendering and changing palettes in the middle of the frame ends up being very complicated, so we'll keep it simple for now.
This commit is contained in:
Sam Lantinga
2025-09-27 10:57:52 -07:00
parent 7dcc09986d
commit 2a01e12d34
3 changed files with 15 additions and 109 deletions

View File

@@ -1900,17 +1900,6 @@ 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);
}