comparison src/video/windib/SDL_dibvideo.c @ 4075:0207ca19fd8f SDL-1.2

Fixed building on Windows CE
author Sam Lantinga <slouken@libsdl.org>
date Sun, 15 Jul 2007 19:43:54 +0000
parents c75679dce60c
children fda6e33893b7
comparison
equal deleted inserted replaced
4074:fd1cbe7a706c 4075:0207ca19fd8f
937 entry->peRed = colors[i].r; 937 entry->peRed = colors[i].r;
938 entry->peGreen = colors[i].g; 938 entry->peGreen = colors[i].g;
939 entry->peBlue = colors[i].b; 939 entry->peBlue = colors[i].b;
940 entry->peFlags = PC_NOCOLLAPSE; 940 entry->peFlags = PC_NOCOLLAPSE;
941 } 941 }
942 #ifdef SYSPAL_NOSTATIC
942 /* Check to make sure black and white are in position */ 943 /* Check to make sure black and white are in position */
943 if ( GetSystemPaletteUse(hdc) != SYSPAL_NOSTATIC256 ) { 944 if ( GetSystemPaletteUse(hdc) != SYSPAL_NOSTATIC256 ) {
944 moved_entries += CheckPaletteEntry(screen_logpal, 0, 0x00, 0x00, 0x00); 945 moved_entries += CheckPaletteEntry(screen_logpal, 0, 0x00, 0x00, 0x00);
945 moved_entries += CheckPaletteEntry(screen_logpal, screen_logpal->palNumEntries-1, 0xff, 0xff, 0xff); 946 moved_entries += CheckPaletteEntry(screen_logpal, screen_logpal->palNumEntries-1, 0xff, 0xff, 0xff);
946 } 947 }
948 If we don't have full access to the palette, what we 949 If we don't have full access to the palette, what we
949 really want to do is find the 236 most diverse colors 950 really want to do is find the 236 most diverse colors
950 in the desired palette, set those entries (10-245) and 951 in the desired palette, set those entries (10-245) and
951 then map everything into the new system palette. 952 then map everything into the new system palette.
952 */ 953 */
953 954 #endif
955
956 #ifndef _WIN32_WCE
954 /* Copy the entries into the system palette */ 957 /* Copy the entries into the system palette */
955 UnrealizeObject(screen_pal); 958 UnrealizeObject(screen_pal);
959 #endif
956 SetPaletteEntries(screen_pal, 0, screen_logpal->palNumEntries, screen_logpal->palPalEntry); 960 SetPaletteEntries(screen_pal, 0, screen_logpal->palNumEntries, screen_logpal->palPalEntry);
957 SelectPalette(hdc, screen_pal, FALSE); 961 SelectPalette(hdc, screen_pal, FALSE);
958 RealizePalette(hdc); 962 RealizePalette(hdc);
959 } 963 }
960 964
1154 } 1158 }
1155 1159
1156 /* Exported for the windows message loop only */ 1160 /* Exported for the windows message loop only */
1157 static void DIB_GrabStaticColors(HWND window) 1161 static void DIB_GrabStaticColors(HWND window)
1158 { 1162 {
1163 #ifdef SYSPAL_NOSTATIC
1159 HDC hdc; 1164 HDC hdc;
1160 1165
1161 hdc = GetDC(window); 1166 hdc = GetDC(window);
1162 SetSystemPaletteUse(hdc, SYSPAL_NOSTATIC256); 1167 SetSystemPaletteUse(hdc, SYSPAL_NOSTATIC256);
1163 if ( GetSystemPaletteUse(hdc) != SYSPAL_NOSTATIC256 ) { 1168 if ( GetSystemPaletteUse(hdc) != SYSPAL_NOSTATIC256 ) {
1164 SetSystemPaletteUse(hdc, SYSPAL_NOSTATIC); 1169 SetSystemPaletteUse(hdc, SYSPAL_NOSTATIC);
1165 } 1170 }
1166 ReleaseDC(window, hdc); 1171 ReleaseDC(window, hdc);
1172 #endif
1167 } 1173 }
1168 static void DIB_ReleaseStaticColors(HWND window) 1174 static void DIB_ReleaseStaticColors(HWND window)
1169 { 1175 {
1176 #ifdef SYSPAL_NOSTATIC
1170 HDC hdc; 1177 HDC hdc;
1171 1178
1172 hdc = GetDC(window); 1179 hdc = GetDC(window);
1173 SetSystemPaletteUse(hdc, SYSPAL_STATIC); 1180 SetSystemPaletteUse(hdc, SYSPAL_STATIC);
1174 ReleaseDC(window, hdc); 1181 ReleaseDC(window, hdc);
1182 #endif
1175 } 1183 }
1176 static void DIB_Activate(_THIS, BOOL active, BOOL minimized) 1184 static void DIB_Activate(_THIS, BOOL active, BOOL minimized)
1177 { 1185 {
1178 if ( screen_pal && (this->screen->flags & SDL_HWPALETTE) ) { 1186 if ( screen_pal && (this->screen->flags & SDL_HWPALETTE) ) {
1179 if ( !active ) { 1187 if ( !active ) {
1189 { 1197 {
1190 if ( screen_pal != NULL ) { 1198 if ( screen_pal != NULL ) {
1191 HDC hdc; 1199 HDC hdc;
1192 1200
1193 hdc = GetDC(SDL_Window); 1201 hdc = GetDC(SDL_Window);
1202 #ifndef _WIN32_WCE
1194 UnrealizeObject(screen_pal); 1203 UnrealizeObject(screen_pal);
1204 #endif
1195 SelectPalette(hdc, screen_pal, FALSE); 1205 SelectPalette(hdc, screen_pal, FALSE);
1196 if ( RealizePalette(hdc) ) { 1206 if ( RealizePalette(hdc) ) {
1197 InvalidateRect(SDL_Window, NULL, FALSE); 1207 InvalidateRect(SDL_Window, NULL, FALSE);
1198 } 1208 }
1199 ReleaseDC(SDL_Window, hdc); 1209 ReleaseDC(SDL_Window, hdc);