Commit 54478fc8 authored by Sam Lantinga's avatar Sam Lantinga

Fixed a bug in detecting surface mapping changes

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40846
parent 5de765a4
...@@ -246,7 +246,12 @@ SDL_PixelFormat *SDL_ReallocFormat(SDL_Surface *surface, int bpp, ...@@ -246,7 +246,12 @@ SDL_PixelFormat *SDL_ReallocFormat(SDL_Surface *surface, int bpp,
*/ */
void SDL_FormatChanged(SDL_Surface *surface) 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); SDL_InvalidateMap(surface->map);
} }
/* /*
......
...@@ -106,9 +106,9 @@ SDL_Surface * SDL_CreateRGBSurface (Uint32 flags, ...@@ -106,9 +106,9 @@ SDL_Surface * SDL_CreateRGBSurface (Uint32 flags,
surface->hwdata = NULL; surface->hwdata = NULL;
surface->locked = 0; surface->locked = 0;
surface->map = NULL; surface->map = NULL;
surface->format_version = 0;
surface->unused1 = 0; surface->unused1 = 0;
SDL_SetClipRect(surface, NULL); SDL_SetClipRect(surface, NULL);
SDL_FormatChanged(surface);
/* Get the pixels */ /* Get the pixels */
if ( ((flags&SDL_HWSURFACE) == SDL_SWSURFACE) || if ( ((flags&SDL_HWSURFACE) == SDL_SWSURFACE) ||
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment