Fixed a bug in detecting surface mapping changes
authorSam Lantinga <slouken@libsdl.org>
Thu, 19 Feb 2004 21:13:24 +0000
changeset 845333db1d87876
parent 844 cd0c77df70a4
child 846 96ba4eab74fb
Fixed a bug in detecting surface mapping changes
src/video/SDL_pixels.c
src/video/SDL_surface.c
     1.1 --- a/src/video/SDL_pixels.c	Wed Feb 18 03:57:13 2004 +0000
     1.2 +++ b/src/video/SDL_pixels.c	Thu Feb 19 21:13:24 2004 +0000
     1.3 @@ -246,7 +246,12 @@
     1.4   */
     1.5  void SDL_FormatChanged(SDL_Surface *surface)
     1.6  {
     1.7 -	surface->format_version++;
     1.8 +	static int format_version = 0;
     1.9 +	++format_version;
    1.10 +	if ( format_version < 0 ) { /* It wrapped... */
    1.11 +		format_version = 1;
    1.12 +	}
    1.13 +	surface->format_version = format_version;
    1.14  	SDL_InvalidateMap(surface->map);
    1.15  }
    1.16  /*
     2.1 --- a/src/video/SDL_surface.c	Wed Feb 18 03:57:13 2004 +0000
     2.2 +++ b/src/video/SDL_surface.c	Thu Feb 19 21:13:24 2004 +0000
     2.3 @@ -106,9 +106,9 @@
     2.4  	surface->hwdata = NULL;
     2.5  	surface->locked = 0;
     2.6  	surface->map = NULL;
     2.7 -	surface->format_version = 0;
     2.8  	surface->unused1 = 0;
     2.9  	SDL_SetClipRect(surface, NULL);
    2.10 +	SDL_FormatChanged(surface);
    2.11  
    2.12  	/* Get the pixels */
    2.13  	if ( ((flags&SDL_HWSURFACE) == SDL_SWSURFACE) ||