Fixed palette bug on non-WinCE
authorSam Lantinga <slouken@libsdl.org>
Sun, 29 Jan 2006 22:23:54 +0000
changeset 129259c7a470a51e
parent 1291 31331c444ea2
child 1293 23b1ef7d003b
Fixed palette bug on non-WinCE
src/video/windib/SDL_dibvideo.c
     1.1 --- a/src/video/windib/SDL_dibvideo.c	Sun Jan 29 22:09:26 2006 +0000
     1.2 +++ b/src/video/windib/SDL_dibvideo.c	Sun Jan 29 22:23:54 2006 +0000
     1.3 @@ -773,13 +773,13 @@
     1.4  
     1.5  int DIB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
     1.6  {
     1.7 +#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400)
     1.8 +	HDC hdc, mdc;
     1.9  	RGBQUAD *pal;
    1.10 +#else
    1.11 +	HDC hdc;
    1.12 +#endif
    1.13  	int i;
    1.14 -#if (_WIN32_WCE < 400 )
    1.15 -	HDC hdc;
    1.16 -#else
    1.17 -	HDC hdc, mdc;
    1.18 -#endif
    1.19  
    1.20  	/* Update the display palette */
    1.21  	hdc = GetDC(SDL_Window);
    1.22 @@ -798,6 +798,7 @@
    1.23  		RealizePalette(hdc);
    1.24  	}
    1.25  
    1.26 +#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400)
    1.27  	/* Copy palette colors into DIB palette */
    1.28  	pal = (RGBQUAD *)alloca(ncolors*sizeof(RGBQUAD));
    1.29  	for ( i=0; i<ncolors; ++i ) {
    1.30 @@ -808,7 +809,6 @@
    1.31  	}
    1.32  
    1.33  	/* Set the DIB palette and update the display */
    1.34 -#if ( _WIN32_WCE >= 400 )
    1.35  	mdc = CreateCompatibleDC(hdc);
    1.36  	SelectObject(mdc, screen_bmp);
    1.37  	SetDIBColorTable(mdc, firstcolor, ncolors, pal);