This code only does RealisePalette once when it creates the device context but it updates the color table whenever the calculator contrast gets updated in the latest code, followed by a SetDIBColorTable. Maybe the problem is there or maybe there is some condition for going to the color map rather than the palette that the test in dib.c doesn't currently capture. I'll do some monkeying around with the MinGW version under windows and look at the palette vs. the color map to see if windows keeps them in sync. I downloaded the very latest version (1.36) and it behaves much better. The lcd display palette is still mucked up but it is a legible black and white and everything else I tried works. If I do my little hack in dib.c with regards to the palette then even the lcd display looks right so its already on the working list and if I can figure out the right answer it will be on the fully working list. Cool!
Dave Dave At 07:04 PM 6/8/2005, you wrote:
tir, 07,.06.2005 kl. 23.00 -0700, skrev David Albrecht:
VOID CreateLcdBitmap(VOID) { // create LCD bitmap _ASSERT(nLcdDoubled == 1 || nLcdDoubled == 2 || nLcdDoubled == 4); bmiLcd.Lcd_bmih.biWidth = LCD1_ROW * nLcdDoubled; bmiLcd.Lcd_bmih.biHeight = -64 * nLcdDoubled; hLcdDC = CreateCompatibleDC(hWindowDC); _ASSERT(hLcdDC != NULL); hLcdBitmap = CreateDIBSection(hLcdDC, (BITMAPINFO*)&bmiLcd,DIB_RGB_COLORS, (LPVOID*)&pbyLcd, NULL, 0); _ASSERT(hLcdBitmap != NULL); hOldLcdBitmap = SelectObject(hLcdDC, hLcdBitmap); _ASSERT(hPalette != NULL); SelectPalette(hLcdDC, hPalette, FALSE); // set palette for LCD DC RealizePalette(hLcdDC); //
realize palette
UpdateContrast(Chipset.contrast);
}
When creating a memory DC for an 8-bit DIB section, it is normal to create a palette matching the DIB color table, then just selecting it into that DC. In such usage, RealizePalette is not used. Perhaps there's an explanation to be found in that direction.
MSDN says, for example:
"The RealizePalette function modifies the palette for the device associated with the specified device context. If the device context is a memory DC, the color table for the bitmap selected into the DC is modified. If the device context is a display DC, the physical palette for that device is modified."
This suggests that RealizePalette should set the DIB color table from the palette, something Wine might not do properly. Although this is the opposite of your hack, it does make the palette and the DIB color table identical again, so perhaps it would still work for you.