DirectFB: fixed creation of palette textures

This commit is contained in:
Sylvain
2021-10-01 22:30:51 +02:00
parent 83d600904b
commit 77acd44f28
2 changed files with 32 additions and 2 deletions

View File

@@ -324,6 +324,22 @@ DirectFB_AcquireVidLayer(SDL_Renderer * renderer, SDL_Texture * texture)
return 1;
}
/* Copy the SDL_Surface palette to the DirectFB texture palette */
void DirectFB_SetTexturePalette(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Palette *pal)
{
int i;
DFBColor dfbpal[256];
DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
for (i = 0; i < pal->ncolors; i++) {
dfbpal[i].a = pal->colors[i].a;
dfbpal[i].r = pal->colors[i].r;
dfbpal[i].g = pal->colors[i].g;
dfbpal[i].b = pal->colors[i].b;
}
data->palette->SetEntries(data->palette, dfbpal, pal->ncolors, 0);
}
static int
DirectFB_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{