[SDL] SDL_ConvertSurface wierdness.
Mattias Engdegård
f91-men at nada.kth.se
Tue Sep 19 11:08:50 PDT 2000
> /* Copy the palette if any */
> if ( format->palette ) {
>> memcpy(convert->format->palette->colors,
> format->palette->colors,
> format->palette->ncolors * sizeof(SDL_Color));
> }
urgh, and I thought I went through that code already. There's another
problem here: is palette->ncolors the number of colours actually used in
the palette, or the maximum palette size?
Several image loaders set palette->ncolors to the number of colours in
the colormap of the image, and this can be useful (testpalette uses it).
This means that SDL_SetPalette() (and SDL_SetColors()) which interpret
palette->ncolors as the maximum palette size are doing wrong.
They should use 2**(BitsPerPixel) instead. Right, Sam?
More information about the SDL
mailing list