changeset 45:60a6e045808e

Fix palette creation in windowed mode at 8 bpp
author Sam Lantinga <slouken@lokigames.com>
date Thu, 07 Jun 2001 13:52:10 +0000
parents 25091c75acc4
children 3dcf26fa9d15
files src/video/windib/SDL_dibvideo.c
diffstat 1 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/windib/SDL_dibvideo.c	Sun May 27 01:04:01 2001 +0000
+++ b/src/video/windib/SDL_dibvideo.c	Thu Jun 07 13:52:10 2001 +0000
@@ -522,22 +522,24 @@
 		settings.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;
 		if ( ChangeDisplaySettings(&settings, CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL ) {
 			video->flags |= SDL_FULLSCREEN;
-			if ( screen_pal != NULL ) {
-			/*	RJR: March 28, 2000
-				delete identity palette if switching from a palettized mode */
-				DeleteObject(screen_pal);
-				screen_pal = NULL;
-			}
-			if ( bpp <= 8 )
-			{
-			/*	RJR: March 28, 2000
-				create identity palette switching to a palettized mode */
-				screen_pal = DIB_CreatePalette(bpp);
-			}
 		}
 	}
 #endif /* !NO_CHANGEDISPLAYSETTINGS */
 
+	/* Reset the palette and create a new one if necessary */
+	if ( screen_pal != NULL ) {
+	/*	RJR: March 28, 2000
+		delete identity palette if switching from a palettized mode */
+		DeleteObject(screen_pal);
+		screen_pal = NULL;
+	}
+	if ( bpp <= 8 )
+	{
+	/*	RJR: March 28, 2000
+		create identity palette switching to a palettized mode */
+		screen_pal = DIB_CreatePalette(bpp);
+	}
+
 	style = GetWindowLong(SDL_Window, GWL_STYLE);
 #ifndef _WIN32_WCE
 	style &= ~(resizestyle|WS_MAXIMIZE);