Skip to content

Commit

Permalink
Fixed a bug in detecting surface mapping changes
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Feb 19, 2004
1 parent 69a5450 commit e36bb6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/video/SDL_pixels.c
Expand Up @@ -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);
}
/*
Expand Down
2 changes: 1 addition & 1 deletion src/video/SDL_surface.c
Expand Up @@ -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) ||
Expand Down

0 comments on commit e36bb6a

Please sign in to comment.