Fixed a bug in detecting surface mapping changes

This commit is contained in:
Sam Lantinga 2004-02-19 21:13:24 +00:00
parent 9e02d4aecb
commit d2a487772f
2 changed files with 7 additions and 2 deletions

View File

@ -246,7 +246,12 @@ SDL_PixelFormat *SDL_ReallocFormat(SDL_Surface *surface, int bpp,
*/
void SDL_FormatChanged(SDL_Surface *surface)
{
surface->format_version++;
static int format_version = 0;
++format_version;
if ( format_version < 0 ) { /* It wrapped... */
format_version = 1;
}
surface->format_version = format_version;
SDL_InvalidateMap(surface->map);
}
/*

View File

@ -106,9 +106,9 @@ SDL_Surface * SDL_CreateRGBSurface (Uint32 flags,
surface->hwdata = NULL;
surface->locked = 0;
surface->map = NULL;
surface->format_version = 0;
surface->unused1 = 0;
SDL_SetClipRect(surface, NULL);
SDL_FormatChanged(surface);
/* Get the pixels */
if ( ((flags&SDL_HWSURFACE) == SDL_SWSURFACE) ||