Need a few sugestions from you

mornin’ guys,

i have the following procedure that fades out the current screen to the color given.

void fade_out(Uint32 color) {
SDL_Surface *s;
short int e;
s = SDL_CreateRGBSurface(SDL_SWSURFACE, SCREEN->w, SCREEN->h,
SCREEN->format->BitsPerPixel,
SCREEN->format->Rmask,
SCREEN->format->Gmask,
SCREEN->format->Bmask,
SCREEN->format->Amask);
SDL_BlitSurface(SCREEN, NULL, s, NULL);

   for(e = 255; e > 0; e -= 10) {
            SDL_FillRect(SCREEN, NULL, color);
            SDL_SetAlpha(s, SDL_SRCALPHA|SDL_RLEACCEL, e);
            SDL_BlitSurface(s, NULL, SCREEN, NULL);
            SDL_Flip(SCREEN);
    }
    SDL_FreeSurface(s);

}

it works fine, though a bit slow on higher resolutions. so i ask you if you could gimme a few sugestions on how to improve this code to make it
faster or anything else that goes into your geek-minds.
thanks a lot,
c ya,
–skinncode

hi,
i am green in sdl but i think that use of SDL_DisplayFormat should help.

Jan Kratochvil.> mornin’ guys,

i have the following procedure that fades out the current screen to the color given.

void fade_out(Uint32 color) {
SDL_Surface *s;
short int e;
s = SDL_CreateRGBSurface(SDL_SWSURFACE, SCREEN->w, SCREEN->h,
SCREEN->format->BitsPerPixel,
SCREEN->format->Rmask,
SCREEN->format->Gmask,
SCREEN->format->Bmask,
SCREEN->format->Amask);
SDL_BlitSurface(SCREEN, NULL, s, NULL);

   for(e = 255; e > 0; e -= 10) {
            SDL_FillRect(SCREEN, NULL, color);
            SDL_SetAlpha(s, SDL_SRCALPHA|SDL_RLEACCEL, e);
            SDL_BlitSurface(s, NULL, SCREEN, NULL);
            SDL_Flip(SCREEN);
    }
    SDL_FreeSurface(s);

}

it works fine, though a bit slow on higher resolutions. so i ask you if you could gimme a few sugestions on how to improve this code to make it
faster or anything else that goes into your geek-minds.
thanks a lot,
c ya,
–skinncode