From 11c276109cfdacc0bcc78e7c42952e9cd9fdbfbd Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 13 Dec 2025 10:58:21 +0200 Subject: [PATCH] [WIN32K:NTGDI] Mark 2-color indexed palettes as monochrome This is mostly an optimization, as translation from RGB to mono are much faster than generic indexed palettes. It exposes a broken RGB-to-mono translation though, which previously was hidden for DIB sections, which didn't mark the palette as mono, therefore taking the slow index path, which worked correctly. --- win32ss/gdi/ntgdi/palette.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/win32ss/gdi/ntgdi/palette.c b/win32ss/gdi/ntgdi/palette.c index 05832f99142..41a3d9639c9 100644 --- a/win32ss/gdi/ntgdi/palette.c +++ b/win32ss/gdi/ntgdi/palette.c @@ -149,6 +149,9 @@ PALETTE_AllocPalette( /* Check color count */ if ((cColors == 0) || (cColors > 1024)) return NULL; + /* Mark 2 color indexed palettes as monochrome */ + if (cColors == 2) iMode |= PAL_MONOCHROME; + /* Allocate enough space for the palete entries */ cjSize += cColors * sizeof(PALETTEENTRY); }