Hi all!
After an unpleasant debugging session, I traced my problem
down to SDL_CreateRGBSurface. I found the following piece of code:
if ( screen && ((screen->flags&SDL_HWSURFACE) == SDL_HWSURFACE) ) {
if ( (flags&(SDL_SRCCOLORKEY|SDL_SRCALPHA)) != 0 ) {
flags |= SDL_HWSURFACE;
}
Note that the code above puts all surfaces in video ram,
even if they are requested as SDL_SWSURFACE (if either
SDL_SRCCOLORKEY or SDL_SRCALPHA is set).
This behavior contradicts the docs for SDL_CreateRGBSurface:
“This flag turns on colourkeying for blits from this surface. If SDL_HWSURFACE is also specified and
colourkeyed blits are hardware-accelerated, then SDL will attempt to place the surface in video memory.
Use SDL_SetColorKey to set or clear this flag after surface creation.”
This way, it’s not possible to allocate a surface with a color-key in
normal ram. I first had to create it without a color-key, and then
use SDL_SetColorKey as a work-around.
So please either change the docs or this if-statement!
Ciao and thanks,
Elmar