mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-22 15:48:09 -05:00
fix MxPalette::GetDefaultPalette
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
This commit is contained in:
parent
db0b0a28ae
commit
63f2215737
1 changed files with 11 additions and 9 deletions
|
@ -27,16 +27,18 @@ MxResult MxPalette::GetEntries(LPPALETTEENTRY p_entries)
|
|||
void MxPalette::GetDefaultPalette(LPPALETTEENTRY p_entries)
|
||||
{
|
||||
HDC hdc = GetDC((HWND) NULL);
|
||||
int rasterCaps = GetDeviceCaps(hdc, RASTERCAPS);
|
||||
if ((rasterCaps & RC_PALETTE) != 0) {
|
||||
int paletteSize = GetDeviceCaps(hdc, SIZEPALETTE);
|
||||
if (paletteSize == 256) {
|
||||
GetSystemPaletteEntries(hdc, 0, 256, p_entries);
|
||||
p_entries += 10;
|
||||
memcpy(p_entries, this->m_entries, sizeof(this->m_entries));
|
||||
}
|
||||
PALETTEENTRY *src;
|
||||
|
||||
if ((rasterCaps & RC_PALETTE) != 0 && GetDeviceCaps(hdc, SIZEPALETTE) == 256) {
|
||||
GetSystemPaletteEntries(hdc, 0, 256, p_entries);
|
||||
count = 256 - 2 * 10;
|
||||
src = &g_defaultPalette[10];
|
||||
p_entries += 10;
|
||||
} else {
|
||||
src = g_defaultPalette;
|
||||
count = 256;
|
||||
}
|
||||
|
||||
memcpy(dest, p_entries, count * sizeof(PALETTEENTRY));
|
||||
ReleaseDC((HWND) NULL, hdc);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue