Fixed palette bug on non-WinCE
authorSam Lantinga <slouken@libsdl.org>
Sun, 29 Jan 2006 22:23:54 +0000
changeset 1292 59c7a470a51e
parent 1291 31331c444ea2
child 1293 23b1ef7d003b
Fixed palette bug on non-WinCE
src/video/windib/SDL_dibvideo.c
--- a/src/video/windib/SDL_dibvideo.c	Sun Jan 29 22:09:26 2006 +0000
+++ b/src/video/windib/SDL_dibvideo.c	Sun Jan 29 22:23:54 2006 +0000
@@ -773,13 +773,13 @@
 
 int DIB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
 {
+#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400)
+	HDC hdc, mdc;
 	RGBQUAD *pal;
-	int i;
-#if (_WIN32_WCE < 400 )
+#else
 	HDC hdc;
-#else
-	HDC hdc, mdc;
 #endif
+	int i;
 
 	/* Update the display palette */
 	hdc = GetDC(SDL_Window);
@@ -798,6 +798,7 @@
 		RealizePalette(hdc);
 	}
 
+#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400)
 	/* Copy palette colors into DIB palette */
 	pal = (RGBQUAD *)alloca(ncolors*sizeof(RGBQUAD));
 	for ( i=0; i<ncolors; ++i ) {
@@ -808,7 +809,6 @@
 	}
 
 	/* Set the DIB palette and update the display */
-#if ( _WIN32_WCE >= 400 )
 	mdc = CreateCompatibleDC(hdc);
 	SelectObject(mdc, screen_bmp);
 	SetDIBColorTable(mdc, firstcolor, ncolors, pal);