From 11ab4ae167bd36f491d5c439ba041c01ed3d85b3 Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Thu, 29 Jun 2023 17:26:23 -0400 Subject: [PATCH] Revert "fix MxPalette::GetDefaultPalette" This reverts commit 63f2215737d3bcd286f67dcf1a04fdf8a234d41b. --- LEGO1/mxpalette.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/LEGO1/mxpalette.cpp b/LEGO1/mxpalette.cpp index 668ff908..7e0de560 100644 --- a/LEGO1/mxpalette.cpp +++ b/LEGO1/mxpalette.cpp @@ -27,18 +27,16 @@ MxResult MxPalette::GetEntries(LPPALETTEENTRY p_entries) void MxPalette::GetDefaultPalette(LPPALETTEENTRY p_entries) { HDC hdc = GetDC((HWND) NULL); - 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; + 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)); + } } - memcpy(dest, p_entries, count * sizeof(PALETTEENTRY)); + ReleaseDC((HWND) NULL, hdc); }