From 196349d5509dd382530924bc7cda63bbf5470840 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 26 Apr 2012 16:32:01 +0000 Subject: [PATCH] [WIN32K] Fix palette index wraparound when initializing a DIB palette with DIB_PAL_COLORS. Fixes gdi32_winetest::palette svn path=/trunk/; revision=56430 --- reactos/win32ss/gdi/ntgdi/dibobj.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/reactos/win32ss/gdi/ntgdi/dibobj.c b/reactos/win32ss/gdi/ntgdi/dibobj.c index 506b644151b..fe029c21c92 100644 --- a/reactos/win32ss/gdi/ntgdi/dibobj.c +++ b/reactos/win32ss/gdi/ntgdi/dibobj.c @@ -1744,9 +1744,6 @@ DIB_MapPaletteColors(PPALETTE ppal, CONST BITMAPINFO* lpbmi) nNumColors = min(nNumColors, lpbmi->bmiHeader.biClrUsed); } - /* Don't have more colors than we need */ - nNumColors = min(ppal->NumColors, nNumColors); - ppalEntries = ExAllocatePoolWithTag(PagedPool, sizeof(PALETTEENTRY) * nNumColors, TAG_COLORMAP); if (ppalEntries == NULL) { @@ -1758,17 +1755,7 @@ DIB_MapPaletteColors(PPALETTE ppal, CONST BITMAPINFO* lpbmi) for (i = 0; i < nNumColors; i++) { - if (*lpIndex < ppal->NumColors) - { - ppalEntries[i] = ppal->IndexedColors[*lpIndex]; - } - else - { - ppalEntries[i].peRed = 0; - ppalEntries[i].peGreen = 0; - ppalEntries[i].peBlue = 0; - ppalEntries[i].peFlags = 0; - } + ppalEntries[i] = ppal->IndexedColors[*lpIndex % ppal->NumColors]; lpIndex++; }