-
-/*
- * Clear the System Palette so that we can ensure an identity palette
- * mapping for fast performance.
- */
-
-void wxClearSystemPalette(void)
-{
- //*** A dummy palette setup
- struct
- {
- WORD Version;
- WORD NumberOfEntries;
- PALETTEENTRY aEntries[256];
- } Palette =
- {
- 0x300,
- 256
- };
-
- HPALETTE ScreenPalette = 0;
- HDC ScreenDC;
- int Counter;
- UINT nMapped = 0;
- BOOL bOK = FALSE;
- int nOK = 0;
-
- // *** Reset everything in the system palette to black
- for(Counter = 0; Counter < 256; Counter++)
- {
- Palette.aEntries[Counter].peRed = 0;
- Palette.aEntries[Counter].peGreen = 0;
- Palette.aEntries[Counter].peBlue = 0;
- Palette.aEntries[Counter].peFlags = PC_NOCOLLAPSE;
- }
-
- // *** Create, select, realize, deselect, and delete the palette
-#ifdef __WXWINE__
- ScreenDC = GetDC((HWND)NULL);
-#else
- ScreenDC = GetDC(NULL);
-#endif
- ScreenPalette = CreatePalette((LOGPALETTE *)&Palette);
-
- if (ScreenPalette)
- {
- ScreenPalette = SelectPalette(ScreenDC,ScreenPalette,FALSE);
- nMapped = RealizePalette(ScreenDC);
- ScreenPalette = SelectPalette(ScreenDC,ScreenPalette,FALSE);
- bOK = DeleteObject(ScreenPalette);
- }
-
-#ifdef __WXWINE__
- nOK = ReleaseDC((HWND)NULL, ScreenDC);
-#else
- nOK = ReleaseDC(NULL, ScreenDC);
-#endif
-
- return;
-}
-
-