changeset 845:333db1d87876

Fixed a bug in detecting surface mapping changes
author Sam Lantinga <slouken@libsdl.org>
date Thu, 19 Feb 2004 21:13:24 +0000
parents cd0c77df70a4
children 96ba4eab74fb
files src/video/SDL_pixels.c src/video/SDL_surface.c
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/SDL_pixels.c	Wed Feb 18 03:57:13 2004 +0000
+++ b/src/video/SDL_pixels.c	Thu Feb 19 21:13:24 2004 +0000
@@ -246,7 +246,12 @@
  */
 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);
 }
 /*
--- a/src/video/SDL_surface.c	Wed Feb 18 03:57:13 2004 +0000
+++ b/src/video/SDL_surface.c	Thu Feb 19 21:13:24 2004 +0000
@@ -106,9 +106,9 @@
 	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) ||