Skip to content

Commit

Permalink
Allocate a palette for indexed surfaces
Browse files Browse the repository at this point in the history
Fixes #368
  • Loading branch information
slouken committed Jul 12, 2024
1 parent a8582e6 commit aba2fd9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/SDL_ttf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1444,6 +1444,9 @@ static SDL_Surface *AllocateAlignedPixels(size_t width, size_t height, SDL_Pixel
SDL_aligned_free(pixels);
return NULL;
}
if (SDL_ISPIXELFORMAT_INDEXED(format)) {
SDL_SetSurfacePalette(textbuf, SDL_CreatePalette(1 << SDL_BITSPERPIXEL(format)));
}

/* Let SDL handle the memory allocation */
textbuf->flags &= ~SDL_SURFACE_PREALLOCATED;
Expand Down

0 comments on commit aba2fd9

Please sign in to comment.