Hw->hw blit problem

Greetings all,

I’m trying to speed up my blitting code by making sure as many of my
surfaces are hardware based as possible… I do this by uncommenting the
following piece of code just after I have loaded a BMP image:

SDL_Surface *sf = SDL_LoadBMP( filename );

if(sf)
{
// make the color black transparent for graphic surfaces
SDL_SetColorKey( sf, SDL_SRCCOLORKEY | SDL_RLEACCEL, 0);

/*
// convert surface to display format and try to put it in Video RAM
SDL_Surface *screen = SDL_GetVideoSurface();
if(screen != NULL)
{
SDL_Surface *newsf = SDL_ConvertSurface( sf, screen->format,
SDL_HWSURFACE );
if(newsf != NULL)
{
// we got a new surface, free the old one!
SDL_FreeSurface( sf );
sf = newsf;
}
}
*/

}

If I do this, I get much faster blitting… but then when I call
SDL_Quit() it crashes!
If I do not uncomment this block, everything works fine! (but slow)

What am I doing wrong?
Regards
Anders

Woops! Sorry, that one went out too soon :o)

The program crashes (Access Violation) when I call
SDL_FreeSurface( sf ), not when calling SDL_Quit().

Sorry again
Anders> ----- Original Message -----

From: @Anders_Emil_Hansen (Anders Emil Hansen)
To:
Sent: Wednesday, December 19, 2001 1:28 AM
Subject: hw->hw blit problem

Greetings all,

I’m trying to speed up my blitting code by making sure as many of my
surfaces are hardware based as possible… I do this by uncommenting
the
following piece of code just after I have loaded a BMP image:

SDL_Surface *sf = SDL_LoadBMP( filename );

if(sf)
{
// make the color black transparent for graphic surfaces
SDL_SetColorKey( sf, SDL_SRCCOLORKEY | SDL_RLEACCEL, 0);

/*
// convert surface to display format and try to put it in Video RAM
SDL_Surface *screen = SDL_GetVideoSurface();
if(screen != NULL)
{
SDL_Surface *newsf = SDL_ConvertSurface( sf, screen->format,
SDL_HWSURFACE );
if(newsf != NULL)
{
// we got a new surface, free the old one!
SDL_FreeSurface( sf );
sf = newsf;
}
}
*/

}

If I do this, I get much faster blitting… but then when I call
SDL_Quit() it crashes!
If I do not uncomment this block, everything works fine! (but slow)

What am I doing wrong?
Regards
Anders