SDL_RLEACCEL and its behavior

Hi,
i tried to use SDL_RLEACCEL and i noticed that if i call
SDL_SetAlpha(surface,SDL_RLEACCEL,0); then after it surface->flags doesn’t
contains SDL_RLEACCEL flag. Is it bug or my misunderstanding?
Thanks for your help
Jan Kratochvil
(working on w2k,athlon)
minimalized example attached

#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <stdlib.h>

void Test();
int main(int argc, char *argv[])
{

if (SDL_Init(SDL_INIT_VIDEO)==-1)
{
printf(“Error: cannot initialize SDL\n”);
exit( -1 );
}

SDL_SetVideoMode(600,480,32,SDL_HWSURFACE);

Test();
SDL_Quit();
}

void Test()
{

SDL_Surface *tmpsurface;
SDL_Surface *_mainsurface;

tmpsurface = IMG_Load("./fighter.tga");

SDL_SetAlpha(tmpsurface,SDL_RLEACCEL,255);
// SDL_SetColorKey(tmpsurface,SDL_RLEACCEL,0);
if (tmpsurface->flags & SDL_RLEACCEL)
{
printf(“tmpsurface. OK. \n”);
}
else
{
printf(“tmpsurface. FALSE.\n”);
}
_mainsurface = SDL_DisplayFormatAlpha(tmpsurface);
if (_mainsurface->flags & SDL_RLEACCEL)
{
printf("_mainsurface. OK. \n");
}
else
{
printf("_mainsurface. FALSE.\n");
}

SDL_FreeSurface(tmpsurface);
}

Hi,
i tried to use SDL_RLEACCEL and i noticed that if i call
SDL_SetAlpha(surface,SDL_RLEACCEL,0); then after it surface->flags doesn’t
contains SDL_RLEACCEL flag. Is it bug or my misunderstanding?

After all I know, the surface is being analyzed and converted upon the first
blitting. So you probably should do
SDL_SetAlpha(surface,SDL_RLEACCEL,0);
SDL_BlitSurface(surface,…);
and then check.

HTH,

Pius II.

yes it is :slight_smile: thank u. In SDL_SetAlpha is set SDL_RLEACCELOK flag. And it is
converted after Blit.

After all I know, the surface is being analyzed and converted upon the
first> blitting. So you probably should do
SDL_SetAlpha(surface,SDL_RLEACCEL,0);
SDL_BlitSurface(surface,…);
and then check.

HTH,

Pius II.