(svn r2746) -Fix: SDL_SetColors() has the number of palette entries to change as parameter, not one beyond the last entry to change
authortron
Fri, 29 Jul 2005 10:16:49 +0000
changeset 2226 efc1f77d27fc
parent 2225 e60b20805e4d
child 2227 24f19bde1400
(svn r2746) -Fix: SDL_SetColors() has the number of palette entries to change as parameter, not one beyond the last entry to change
video/sdl_v.c
--- a/video/sdl_v.c	Fri Jul 29 09:45:25 2005 +0000
+++ b/video/sdl_v.c	Fri Jul 29 10:16:49 2005 +0000
@@ -34,20 +34,19 @@
 	_num_dirty_rects++;
 }
 
-static SDL_Color pal[256];
-
-static void UpdatePalette(uint start, uint end)
+static void UpdatePalette(uint start, uint count)
 {
+	SDL_Color pal[256];
 	uint i;
 
-	for (i = start; i != end; i++) {
-		pal[i].r = _cur_palette[i].r;
-		pal[i].g = _cur_palette[i].g;
-		pal[i].b = _cur_palette[i].b;
+	for (i = 0; i != count; i++) {
+		pal[i].r = _cur_palette[start + i].r;
+		pal[i].g = _cur_palette[start + i].g;
+		pal[i].b = _cur_palette[start + i].b;
 		pal[i].unused = 0;
 	}
 
-	SDL_CALL SDL_SetColors(_sdl_screen, pal, start, end);
+	SDL_CALL SDL_SetColors(_sdl_screen, pal, start, count);
 }
 
 static void InitPalette(void)
@@ -57,8 +56,8 @@
 
 static void CheckPaletteAnim(void)
 {
-	if(_pal_last_dirty != -1) {
-		UpdatePalette(_pal_first_dirty, _pal_last_dirty + 1);
+	if (_pal_last_dirty != -1) {
+		UpdatePalette(_pal_first_dirty, _pal_last_dirty - _pal_first_dirty + 1);
 		_pal_last_dirty = -1;
 	}
 }