mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Convert between RGBQUAD and COLORREF when creating a palette for a DIB
svn path=/trunk/; revision=4246
This commit is contained in:
parent
d339a04507
commit
bceffa7c9b
1 changed files with 12 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: dc.c,v 1.48 2003/03/04 10:09:01 gvg Exp $
|
||||
/* $Id: dc.c,v 1.49 2003/03/06 00:57:44 gvg Exp $
|
||||
*
|
||||
* DC.C - Device context functions
|
||||
*
|
||||
|
@ -1029,7 +1029,8 @@ HGDIOBJ STDCALL W32kSelectObject(HDC hDC, HGDIOBJ hGDIObj)
|
|||
PXLATEOBJ XlateObj;
|
||||
PPALGDI PalGDI;
|
||||
WORD objectMagic;
|
||||
ULONG NumColors;
|
||||
COLORREF *ColorMap;
|
||||
ULONG NumColors, Index;
|
||||
|
||||
if(!hDC || !hGDIObj) return NULL;
|
||||
|
||||
|
@ -1095,7 +1096,15 @@ HGDIOBJ STDCALL W32kSelectObject(HDC hDC, HGDIOBJ hGDIObj)
|
|||
if(pb->dib->dsBmih.biBitCount == 4) { NumColors = 16; } else
|
||||
if(pb->dib->dsBmih.biBitCount == 8) { NumColors = 256; }
|
||||
|
||||
dc->w.hPalette = EngCreatePalette(PAL_INDEXED, NumColors, pb->ColorMap, 0, 0, 0);
|
||||
ColorMap = ExAllocatePool(PagedPool, sizeof(COLORREF) * NumColors);
|
||||
for (Index = 0; Index < NumColors; Index++)
|
||||
{
|
||||
ColorMap[Index] = RGB(pb->ColorMap[Index].rgbRed,
|
||||
pb->ColorMap[Index].rgbGreen,
|
||||
pb->ColorMap[Index].rgbBlue);
|
||||
}
|
||||
dc->w.hPalette = EngCreatePalette(PAL_INDEXED, NumColors, ColorMap, 0, 0, 0);
|
||||
ExFreePool(ColorMap);
|
||||
} else
|
||||
if(16 == pb->dib->dsBmih.biBitCount)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue