# HG changeset patch # User Sam Lantinga # Date 1184562500 0 # Node ID fda6e33893b730a1c599b25cd4a243c857c074c1 # Parent 5e6f2972f963e7e49f87fe39ba24e0f9254f0767 Always advertise hardware palette, since Windows will remap colors for us. We do grab the system colors if the application requested fullscreen or a real hardware palette. This allows gamma fading, etc. to work, and is what previous versions did. diff -r 5e6f2972f963 -r fda6e33893b7 src/video/windib/SDL_dibvideo.c --- a/src/video/windib/SDL_dibvideo.c Mon Jul 16 03:27:26 2007 +0000 +++ b/src/video/windib/SDL_dibvideo.c Mon Jul 16 05:08:20 2007 +0000 @@ -637,10 +637,11 @@ #endif /* !NO_CHANGEDISPLAYSETTINGS */ /* Reset the palette and create a new one if necessary */ + if ( grab_palette ) { + DIB_ReleaseStaticColors(SDL_Window); + grab_palette = FALSE; + } if ( screen_pal != NULL ) { - if ( video->flags & SDL_HWPALETTE ) { - DIB_ReleaseStaticColors(SDL_Window); - } /* RJR: March 28, 2000 delete identity palette if switching from a palettized mode */ DeleteObject(screen_pal); @@ -650,6 +651,7 @@ SDL_free(screen_logpal); screen_logpal = NULL; } + if ( bpp <= 8 ) { /* RJR: March 28, 2000 @@ -755,10 +757,11 @@ this->UpdateRects = DIB_NormalUpdate; /* Set video surface flags */ - if ( (flags & (SDL_FULLSCREEN|SDL_HWPALETTE)) != 0 ) { - /* BitBlt() maps colors for us */ - video->flags |= SDL_HWPALETTE; + if ( screen_pal && (flags & (SDL_FULLSCREEN|SDL_HWPALETTE)) ) { + grab_palette = TRUE; } + /* BitBlt() maps colors for us */ + video->flags |= SDL_HWPALETTE; } #ifndef _WIN32_WCE /* Resize the window */ @@ -976,7 +979,7 @@ mdc = CreateCompatibleDC(hdc); SelectObject(mdc, screen_bmp); SetDIBColorTable(mdc, firstcolor, ncolors, pal); - if ( moved_entries || !(this->screen->flags & SDL_HWPALETTE) ) { + if ( moved_entries || !grab_palette ) { BitBlt(hdc, 0, 0, this->screen->w, this->screen->h, mdc, 0, 0, SRCCOPY); } @@ -1098,7 +1101,7 @@ if ( SDL_Window ) { /* Delete the screen bitmap (also frees screen->pixels) */ if ( this->screen ) { - if ( this->screen->flags & SDL_HWPALETTE ) { + if ( grab_palette ) { DIB_ReleaseStaticColors(SDL_Window); } #ifndef NO_CHANGEDISPLAYSETTINGS @@ -1183,7 +1186,7 @@ } static void DIB_Activate(_THIS, BOOL active, BOOL minimized) { - if ( screen_pal && (this->screen->flags & SDL_HWPALETTE) ) { + if ( grab_palette ) { if ( !active ) { DIB_ReleaseStaticColors(SDL_Window); DIB_RealizePalette(this); diff -r 5e6f2972f963 -r fda6e33893b7 src/video/windib/SDL_dibvideo.h --- a/src/video/windib/SDL_dibvideo.h Mon Jul 16 03:27:26 2007 +0000 +++ b/src/video/windib/SDL_dibvideo.h Mon Jul 16 05:08:20 2007 +0000 @@ -41,6 +41,7 @@ HBITMAP screen_bmp; HPALETTE screen_pal; LOGPALETTE *screen_logpal; + BOOL grab_palette; int allow_screensaver; @@ -60,6 +61,7 @@ #define screen_bmp (this->hidden->screen_bmp) #define screen_pal (this->hidden->screen_pal) #define screen_logpal (this->hidden->screen_logpal) +#define grab_palette (this->hidden->grab_palette) #define SDL_nummodes (this->hidden->SDL_nummodes) #define SDL_modelist (this->hidden->SDL_modelist)