ReactOS  r76032
palette.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for palette.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

unsigned short GetNumberOfBits (unsigned int dwMask)
 
INIT_FUNCTION NTSTATUS NTAPI InitPaletteImpl (VOID)
 
VOID FASTCALL PALETTE_ValidateFlags (PALETTEENTRY *lpPalE, INT size)
 
PPALETTE NTAPI PALETTE_AllocPalette (_In_ ULONG iMode, _In_ ULONG cColors, _In_opt_ const PALETTEENTRY *pEntries, _In_ FLONG flRed, _In_ FLONG flGreen, _In_ FLONG flBlue)
 
PPALETTE NTAPI PALETTE_AllocPalWithHandle (_In_ ULONG iMode, _In_ ULONG cColors, _In_opt_ const PALETTEENTRY *pEntries, _In_ FLONG flRed, _In_ FLONG flGreen, _In_ FLONG flBlue)
 
VOID NTAPI PALETTE_vCleanup (PVOID ObjectBody)
 
INT FASTCALL PALETTE_GetObject (PPALETTE ppal, INT cbCount, LPLOGBRUSH lpBuffer)
 
ULONG NTAPI PALETTE_ulGetNearestPaletteIndex (PALETTE *ppal, ULONG iColor)
 
ULONG NTAPI PALETTE_ulGetNearestBitFieldsIndex (PALETTE *ppal, ULONG ulColor)
 
ULONG NTAPI PALETTE_ulGetNearestIndex (PALETTE *ppal, ULONG ulColor)
 
VOID NTAPI PALETTE_vGetBitMasks (PPALETTE ppal, PULONG pulColors)
 
VOID FASTCALL ColorCorrection (PPALETTE PalGDI, PPALETTEENTRY PaletteEntry, ULONG Colors)
 
HPALETTE APIENTRY EngCreatePalette (ULONG iMode, ULONG cColors, ULONG *pulColors, ULONG flRed, ULONG flGreen, ULONG flBlue)
 
BOOL APIENTRY EngDeletePalette (IN HPALETTE hpal)
 
ULONG APIENTRY PALOBJ_cGetColors (PALOBJ *PalObj, ULONG Start, ULONG Colors, ULONG *PaletteEntry)
 
HPALETTE NTAPI GreCreatePaletteInternal (IN LPLOGPALETTE pLogPal, IN UINT cEntries)
 
HPALETTE APIENTRY NtGdiCreatePaletteInternal (IN LPLOGPALETTE plogpalUser, IN UINT cEntries)
 
HPALETTE APIENTRY NtGdiCreateHalftonePalette (HDC hDC)
 
BOOL APIENTRY NtGdiResizePalette (HPALETTE hpal, UINT Entries)
 
BOOL APIENTRY NtGdiGetColorAdjustment (HDC hdc, LPCOLORADJUSTMENT pca)
 
BOOL APIENTRY NtGdiSetColorAdjustment (HDC hdc, LPCOLORADJUSTMENT pca)
 
COLORREF APIENTRY NtGdiGetNearestColor (_In_ HDC hDC, _In_ COLORREF Color)
 
UINT APIENTRY NtGdiGetNearestPaletteIndex (HPALETTE hpal, COLORREF crColor)
 
UINT FASTCALL IntGdiRealizePalette (HDC hDC)
 
UINT APIENTRY IntAnimatePalette (HPALETTE hPal, UINT StartIndex, UINT NumEntries, CONST PPALETTEENTRY PaletteColors)
 
UINT APIENTRY IntGetPaletteEntries (HPALETTE hpal, UINT StartIndex, UINT Entries, LPPALETTEENTRY pe)
 
UINT APIENTRY IntGetSystemPaletteEntries (HDC hDC, UINT StartIndex, UINT Entries, LPPALETTEENTRY pe)
 
UINT APIENTRY IntSetPaletteEntries (HPALETTE hpal, UINT Start, UINT Entries, CONST LPPALETTEENTRY pe)
 
ULONG APIENTRY GreGetSetColorTable (HDC hdc, ULONG iStartIndex, ULONG cEntries, RGBQUAD *prgbColors, BOOL bSet)
 
__kernel_entry LONG APIENTRY NtGdiDoPalette (_In_ HGDIOBJ hObj, _In_ WORD iStart, _In_ WORD cEntries, _When_(bInbound!=0, _In_reads_bytes_(cEntries *sizeof(PALETTEENTRY))) _When_(bInbound==0, _Out_writes_bytes_(cEntries *sizeof(PALETTEENTRY))) LPVOID pUnsafeEntries, _In_ DWORD iFunc, _In_ BOOL bInbound)
 
UINT APIENTRY NtGdiSetSystemPaletteUse (HDC hDC, UINT Usage)
 
UINT APIENTRY NtGdiGetSystemPaletteUse (HDC hDC)
 
BOOL APIENTRY NtGdiUpdateColors (HDC hDC)
 
BOOL APIENTRY NtGdiUnrealizeObject (HGDIOBJ hgdiobj)
 

Variables

static UINT SystemPaletteUse = SYSPAL_NOSTATIC
 
PALETTE gpalRGB
 
PALETTE gpalBGR
 
PALETTE gpalRGB555
 
PALETTE gpalRGB565
 
PALETTEgppalMono
 
PALETTEgppalDefault
 
PPALETTE appalSurfaceDefault [11]
 
const PALETTEENTRY g_sysPalTemplate [NB_RESERVED_COLORS]
 

Macro Definition Documentation

#define NDEBUG

Definition at line 12 of file palette.c.

Function Documentation

VOID FASTCALL ColorCorrection ( PPALETTE  PalGDI,
PPALETTEENTRY  PaletteEntry,
ULONG  Colors 
)

Definition at line 345 of file palette.c.

Referenced by PALOBJ_cGetColors().

346 {
347  PPDEVOBJ ppdev = (PPDEVOBJ)PalGDI->hPDev;
348 
349  if (!ppdev) return;
350 
351  if (ppdev->flFlags & PDEV_GAMMARAMP_TABLE)
352  {
353  ULONG i;
354  PGAMMARAMP GammaRamp = (PGAMMARAMP)ppdev->pvGammaRamp;
355  for ( i = 0; i < Colors; i++)
356  {
357  PaletteEntry[i].peRed += GammaRamp->Red[i];
358  PaletteEntry[i].peGreen += GammaRamp->Green[i];
359  PaletteEntry[i].peBlue += GammaRamp->Blue[i];
360  }
361  }
362  return;
363 }
struct _GAMMARAMP * PGAMMARAMP
WORD Green[256]
Definition: winddi.h:776
WORD Red[256]
Definition: winddi.h:775
PVOID pvGammaRamp
Definition: pdevobj.h:108
struct _PDEVOBJ * PPDEVOBJ
GLenum GLclampf GLint i
Definition: glfuncs.h:14
FLONG flFlags
Definition: pdevobj.h:89
if(!(yy_init))
Definition: macro.lex.yy.c:704
Colors
Definition: ansiprsr.h:4
#define for
Definition: utility.h:88
HDEV hPDev
Definition: palette.h:49
WORD Blue[256]
Definition: winddi.h:777
unsigned int ULONG
Definition: retypes.h:1
HPALETTE APIENTRY EngCreatePalette ( ULONG  iMode,
ULONG  cColors,
ULONG pulColors,
ULONG  flRed,
ULONG  flGreen,
ULONG  flBlue 
)

Display Driver Interface

Definition at line 372 of file palette.c.

Referenced by bInitDefaultPalette(), and IntInitDefaultPalette().

379 {
380  PPALETTE ppal;
381  HPALETTE hpal;
382 
383  ppal = PALETTE_AllocPalette(iMode, cColors, (PPALETTEENTRY)pulColors, flRed, flGreen, flBlue);
384  if (!ppal) return NULL;
385 
387  if (!hpal)
388  {
389  DPRINT1("Could not insert palette into handle table.\n");
391  return NULL;
392  }
393 
394  PALETTE_UnlockPalette(ppal);
395  return hpal;
396 }
_In_ ULONG iMode
Definition: winddi.h:3520
PPALETTE NTAPI PALETTE_AllocPalette(_In_ ULONG iMode, _In_ ULONG cColors, _In_opt_ const PALETTEENTRY *pEntries, _In_ FLONG flRed, _In_ FLONG flGreen, _In_ FLONG flBlue)
Definition: palette.c:132
#define PALETTE_UnlockPalette(pPalette)
Definition: palette.h:56
smooth NULL
Definition: ftsmooth.c:557
BASEOBJECT BaseObject
Definition: palette.h:36
#define GDI_OBJ_HMGR_PUBLIC
Definition: ntgdihdl.h:116
#define DPRINT1
Definition: precomp.h:8
VOID NTAPI GDIOBJ_vFreeObject(POBJ pobj)
Definition: gdiobj.c:591
HGDIOBJ NTAPI GDIOBJ_hInsertObject(POBJ pobj, ULONG ulOwner)
Definition: gdiobj.c:907
BOOL APIENTRY EngDeletePalette ( IN HPALETTE  hpal)

Definition at line 403 of file palette.c.

Referenced by vDisablePalette().

404 {
405  PPALETTE ppal;
406 
407  ppal = PALETTE_ShareLockPalette(hpal);
408  if (!ppal) return FALSE;
409 
411 
412  return TRUE;
413 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define PALETTE_ShareLockPalette(hpal)
Definition: palette.h:57
VOID NTAPI GDIOBJ_vDeleteObject(POBJ pobj)
Definition: gdiobj.c:1106
BASEOBJECT BaseObject
Definition: palette.h:36
unsigned short GetNumberOfBits ( unsigned int  dwMask)

Definition at line 51 of file palette.c.

52 {
53  unsigned short wBits;
54  for (wBits = 0; dwMask; dwMask = dwMask & (dwMask - 1))
55  wBits++;
56  return wBits;
57 }
DWORD dwMask
Definition: msvc.h:86
HPALETTE NTAPI GreCreatePaletteInternal ( IN LPLOGPALETTE  pLogPal,
IN UINT  cEntries 
)

Systemcall Interface

Definition at line 445 of file palette.c.

448 {
449  HPALETTE hpal = NULL;
450  PPALETTE ppal;
451 
452  pLogPal->palNumEntries = cEntries;
454  cEntries,
455  pLogPal->palPalEntry,
456  0, 0, 0);
457 
458  if (ppal != NULL)
459  {
461 
462  hpal = ppal->BaseObject.hHmgr;
463  PALETTE_UnlockPalette(ppal);
464  }
465 
466  return hpal;
467 }
PALETTEENTRY * IndexedColors
Definition: palette.h:42
VOID FASTCALL PALETTE_ValidateFlags(PALETTEENTRY *lpPalE, INT size)
Definition: palette.c:122
#define PALETTE_UnlockPalette(pPalette)
Definition: palette.h:56
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
smooth NULL
Definition: ftsmooth.c:557
PPALETTE NTAPI PALETTE_AllocPalWithHandle(_In_ ULONG iMode, _In_ ULONG cColors, _In_opt_ const PALETTEENTRY *pEntries, _In_ FLONG flRed, _In_ FLONG flGreen, _In_ FLONG flBlue)
Definition: palette.c:206
_In_ UINT _In_ UINT cEntries
Definition: wingdi.h:3597
BASEOBJECT BaseObject
Definition: palette.h:36
ULONG NumColors
Definition: palette.h:41
ULONG APIENTRY GreGetSetColorTable ( HDC  hdc,
ULONG  iStartIndex,
ULONG  cEntries,
RGBQUAD prgbColors,
BOOL  bSet 
)

Definition at line 992 of file palette.c.

Referenced by NtGdiDoPalette().

998 {
999  PDC pdc;
1000  PSURFACE psurf;
1001  PPALETTE ppal = NULL;
1002  ULONG i, iEndIndex, iResult = 0;
1003 
1004  /* Lock the DC */
1005  pdc = DC_LockDc(hdc);
1006  if (!pdc)
1007  {
1008  return 0;
1009  }
1010 
1011  /* Get the surface from the DC */
1012  psurf = pdc->dclevel.pSurface;
1013 
1014  /* Check if we have the default surface */
1015  if (psurf == NULL)
1016  {
1017  /* Use a mono palette */
1018  if (!bSet)
1019  ppal = gppalMono;
1020  }
1021  else if (psurf->SurfObj.iType == STYPE_BITMAP)
1022  {
1023  /* Get the palette of the surface */
1024  ppal = psurf->ppal;
1025  }
1026 
1027  /* Check if this is an indexed palette and the range is ok */
1028  if (ppal && (ppal->flFlags & PAL_INDEXED) &&
1029  (iStartIndex < ppal->NumColors))
1030  {
1031  /* Calculate the end of the operation */
1032  iEndIndex = min(iStartIndex + cEntries, ppal->NumColors);
1033 
1034  /* Check what operation to perform */
1035  if (bSet)
1036  {
1037  /* Loop all colors and set the palette entries */
1038  for (i = iStartIndex; i < iEndIndex; i++, prgbColors++)
1039  {
1040  ppal->IndexedColors[i].peRed = prgbColors->rgbRed;
1041  ppal->IndexedColors[i].peGreen = prgbColors->rgbGreen;
1042  ppal->IndexedColors[i].peBlue = prgbColors->rgbBlue;
1043  }
1044 
1045  /* Mark the dc brushes invalid */
1046  pdc->pdcattr->ulDirty_ |= DIRTY_FILL|DIRTY_LINE|
1048  }
1049  else
1050  {
1051  /* Loop all colors and get the palette entries */
1052  for (i = iStartIndex; i < iEndIndex; i++, prgbColors++)
1053  {
1054  prgbColors->rgbRed = ppal->IndexedColors[i].peRed;
1055  prgbColors->rgbGreen = ppal->IndexedColors[i].peGreen;
1056  prgbColors->rgbBlue = ppal->IndexedColors[i].peBlue;
1057  prgbColors->rgbReserved = 0;
1058  }
1059  }
1060 
1061  /* Calculate how many entries were modified */
1062  iResult = iEndIndex - iStartIndex;
1063  }
1064 
1065  /* Unlock the DC */
1066  DC_UnlockDc(pdc);
1067 
1068  return iResult;
1069 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
PALETTE * gppalMono
Definition: palette.c:17
#define STYPE_BITMAP
Definition: winddi.h:1175
USHORT iType
Definition: winddi.h:1216
PALETTEENTRY * IndexedColors
Definition: palette.h:42
struct _PALETTE *const ppal
Definition: surface.h:11
UCHAR rgbBlue
Definition: inbv.c:96
#define DIRTY_BACKGROUND
Definition: ntgdihdl.h:148
UCHAR rgbGreen
Definition: inbv.c:97
UCHAR rgbRed
Definition: inbv.c:98
GLenum GLclampf GLint i
Definition: glfuncs.h:14
SURFOBJ SurfObj
Definition: surface.h:8
HDC hdc
Definition: msvc.h:53
smooth NULL
Definition: ftsmooth.c:557
Definition: polytest.cpp:40
_In_ UINT _In_ UINT cEntries
Definition: wingdi.h:3597
#define DIRTY_TEXT
Definition: ntgdihdl.h:147
#define DIRTY_FILL
Definition: ntgdihdl.h:145
ULONG NumColors
Definition: palette.h:41
FLONG flFlags
Definition: palette.h:40
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define min(a, b)
Definition: monoChain.cc:55
unsigned int ULONG
Definition: retypes.h:1
#define DIRTY_LINE
Definition: ntgdihdl.h:146
UCHAR rgbReserved
Definition: inbv.c:99
INIT_FUNCTION NTSTATUS NTAPI InitPaletteImpl ( VOID  )

Definition at line 63 of file palette.c.

Referenced by DriverEntry().

64 {
65  // Create default palette (20 system colors)
67  20,
69  0, 0, 0);
72 
73  /* palette_size = visual->map_entries; */
74 
76  gpalRGB.RedMask = RGB(0xFF, 0x00, 0x00);
77  gpalRGB.GreenMask = RGB(0x00, 0xFF, 0x00);
78  gpalRGB.BlueMask = RGB(0x00, 0x00, 0xFF);
81 
83  gpalBGR.RedMask = RGB(0x00, 0x00, 0xFF);
84  gpalBGR.GreenMask = RGB(0x00, 0xFF, 0x00);
85  gpalBGR.BlueMask = RGB(0xFF, 0x00, 0x00);
88 
90  gpalRGB555.RedMask = 0x7C00;
91  gpalRGB555.GreenMask = 0x3E0;
92  gpalRGB555.BlueMask = 0x1F;
95 
97  gpalRGB565.RedMask = 0xF800;
98  gpalRGB565.GreenMask = 0x7E0;
99  gpalRGB565.BlueMask = 0x1F;
102 
106 
107  /* Initialize default surface palettes */
118 
119  return STATUS_SUCCESS;
120 }
#define BMF_24BPP
Definition: winddi.h:359
PALETTE gpalRGB565
Definition: palette.c:17
PALETTE gpalBGR
Definition: palette.c:17
ULONG ulShareCount
Definition: gdiobj.h:42
#define BMF_32BPP
Definition: winddi.h:360
PALETTE * gppalMono
Definition: palette.c:17
return STATUS_SUCCESS
Definition: btrfs.c:2664
#define BMF_8RLE
Definition: winddi.h:362
PALETTE * gppalDefault
Definition: palette.c:17
Definition: xlate.c:8
USHORT BaseFlags
Definition: gdiobj.h:46
FORCEINLINE VOID PALETTE_vSetRGBColorForIndex(PPALETTE ppal, ULONG ulIndex, COLORREF crColor)
Definition: palette.h:152
PPALETTE NTAPI PALETTE_AllocPalette(_In_ ULONG iMode, _In_ ULONG cColors, _In_opt_ const PALETTEENTRY *pEntries, _In_ FLONG flRed, _In_ FLONG flGreen, _In_ FLONG flBlue)
Definition: palette.c:132
#define BMF_PNG
Definition: winddi.h:364
ULONG RedMask
Definition: palette.h:43
#define PALETTE_UnlockPalette(pPalette)
Definition: palette.h:56
#define BMF_4RLE
Definition: winddi.h:361
smooth NULL
Definition: ftsmooth.c:557
#define BMF_16BPP
Definition: winddi.h:358
ULONG BlueMask
Definition: palette.h:45
ULONG GreenMask
Definition: palette.h:44
#define RGB(r, g, b)
Definition: wingdi.h:2917
PPALETTE NTAPI PALETTE_AllocPalWithHandle(_In_ ULONG iMode, _In_ ULONG cColors, _In_opt_ const PALETTEENTRY *pEntries, _In_ FLONG flRed, _In_ FLONG flGreen, _In_ FLONG flBlue)
Definition: palette.c:206
BASEOBJECT BaseObject
Definition: palette.h:36
FLONG flFlags
Definition: palette.h:40
Definition: xlate.c:9
Definition: xlate.c:10
VOID NTAPI GDIOBJ_vReferenceObjectByPointer(POBJ pobj)
Definition: gdiobj.c:729
PPALETTE appalSurfaceDefault[11]
Definition: palette.c:18
PALETTE gpalRGB
Definition: palette.c:17
PALETTE gpalRGB555
Definition: palette.c:17
#define BMF_JPEG
Definition: winddi.h:363
const PALETTEENTRY g_sysPalTemplate[NB_RESERVED_COLORS]
Definition: palette.c:20
UINT APIENTRY IntAnimatePalette ( HPALETTE  hPal,
UINT  StartIndex,
UINT  NumEntries,
CONST PPALETTEENTRY  PaletteColors 
)

Definition at line 783 of file palette.c.

Referenced by NtGdiDoPalette().

787 {
788  UINT ret = 0;
789 
790  if( hPal != NtGdiGetStockObject(DEFAULT_PALETTE) )
791  {
792  PPALETTE palPtr;
794  const PALETTEENTRY *pptr = PaletteColors;
795 
796  palPtr = PALETTE_ShareLockPalette(hPal);
797  if (!palPtr) return FALSE;
798 
799  pal_entries = palPtr->NumColors;
800  if (StartIndex >= pal_entries)
801  {
803  return FALSE;
804  }
805  if (StartIndex+NumEntries > pal_entries) NumEntries = pal_entries - StartIndex;
806 
807  for (NumEntries += StartIndex; StartIndex < NumEntries; StartIndex++, pptr++)
808  {
809  /* According to MSDN, only animate PC_RESERVED colours */
810  if (palPtr->IndexedColors[StartIndex].peFlags & PC_RESERVED)
811  {
812  memcpy( &palPtr->IndexedColors[StartIndex], pptr,
813  sizeof(PALETTEENTRY) );
814  ret++;
815  PALETTE_ValidateFlags(&palPtr->IndexedColors[StartIndex], 1);
816  }
817  }
818 
820 
821 #if 0
822 /* FIXME: This is completely broken! We cannot call UserGetDesktopWindow
823  without first acquiring the USER lock. But the whole process here is
824  screwed anyway. Instead of messing with the desktop DC, we need to
825  check, whether the palette is associated with a PDEV and whether that
826  PDEV supports palette operations. Then we need to call pfnDrvSetPalette.
827  But since IntGdiRealizePalette() is not even implemented for direct DCs,
828  we can as well just do nothing, that will at least not ASSERT!
829  I leave the whole thing here, to scare people away, who want to "fix" it. */
830 
831  /* Immediately apply the new palette if current window uses it */
832  Wnd = UserGetDesktopWindow();
833  hDC = UserGetWindowDC(Wnd);
834  dc = DC_LockDc(hDC);
835  if (NULL != dc)
836  {
837  if (dc->dclevel.hpal == hPal)
838  {
839  DC_UnlockDc(dc);
841  }
842  else
843  DC_UnlockDc(dc);
844  }
845  UserReleaseDC(Wnd,hDC, FALSE);
846 #endif // 0
847  }
848  return ret;
849 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
__kernel_entry W32KAPI HANDLE APIENTRY NtGdiGetStockObject(_In_ INT iObject)
PALETTEENTRY * IndexedColors
Definition: palette.h:42
VOID FASTCALL PALETTE_ValidateFlags(PALETTEENTRY *lpPalE, INT size)
Definition: palette.c:122
HDC FASTCALL UserGetWindowDC(PWND Wnd)
Definition: windc.c:946
HDC dc
Definition: cylfrac.c:34
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:557
#define PALETTE_ShareLockPalette(hpal)
Definition: palette.h:57
HDC hDC
Definition: wglext.h:521
#define DEFAULT_PALETTE
Definition: wingdi.h:911
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:745
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ULONG NumColors
Definition: palette.h:41
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define PC_RESERVED
Definition: wingdi.h:880
#define PALETTE_ShareUnlockPalette(ppal)
Definition: palette.h:59
unsigned int UINT
Definition: ndis.h:50
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:917
int pal_entries[256]
Definition: uimain.c:52
UINT FASTCALL IntGdiRealizePalette(HDC hDC)
Definition: palette.c:728
UINT FASTCALL IntGdiRealizePalette ( HDC  hDC)

FIXME: shouldn't dereference pSurface while the PDEV is not locked

Definition at line 728 of file palette.c.

Referenced by IntAnimatePalette(), and UserRealizePalette().

729 {
730  UINT i, realize = 0;
731  PDC pdc;
732  PALETTE *ppalSurf, *ppalDC;
733 
734  pdc = DC_LockDc(hDC);
735  if (!pdc)
736  {
738  return 0;
739  }
740 
741  if (!pdc->dclevel.pSurface)
742  {
743  goto cleanup;
744  }
745 
746  if (pdc->dctype == DCTYPE_DIRECT)
747  {
748  static BOOL g_WarnedOnce = FALSE;
749  if (!g_WarnedOnce)
750  {
751  g_WarnedOnce = TRUE;
753  }
754  goto cleanup;
755  }
756 
758  ppalSurf = pdc->dclevel.pSurface->ppal;
759  ppalDC = pdc->dclevel.ppal;
760 
761  if (!(ppalSurf->flFlags & PAL_INDEXED))
762  {
763  // FIXME: Set error?
764  goto cleanup;
765  }
766 
767  ASSERT(ppalDC->flFlags & PAL_INDEXED);
768 
769  // FIXME: Should we resize ppalSurf if it's too small?
770  realize = (ppalDC->NumColors < ppalSurf->NumColors) ? ppalDC->NumColors : ppalSurf->NumColors;
771 
772  for (i=0; i<realize; i++)
773  {
774  InterlockedExchange((LONG*)&ppalSurf->IndexedColors[i], *(LONG*)&ppalDC->IndexedColors[i]);
775  }
776 
777 cleanup:
778  DC_UnlockDc(pdc);
779  return realize;
780 }
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
PALETTEENTRY * IndexedColors
Definition: palette.h:42
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
HDC hDC
Definition: wglext.h:521
Definition: polytest.cpp:40
unsigned int BOOL
Definition: ntddk_ex.h:94
#define for
Definition: utility.h:88
ULONG NumColors
Definition: palette.h:41
FLONG flFlags
Definition: palette.h:40
#define InterlockedExchange
Definition: armddk.h:54
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
unsigned int UINT
Definition: ndis.h:50
#define UNIMPLEMENTED
Definition: debug.h:114
char * cleanup(char *str)
Definition: wpickclick.c:99
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
UINT APIENTRY IntGetPaletteEntries ( HPALETTE  hpal,
UINT  StartIndex,
UINT  Entries,
LPPALETTEENTRY  pe 
)

Definition at line 852 of file palette.c.

Referenced by NtGdiDoPalette().

857 {
858  PPALETTE palGDI;
859  UINT numEntries;
860 
861  palGDI = (PPALETTE) PALETTE_ShareLockPalette(hpal);
862  if (NULL == palGDI)
863  {
864  return 0;
865  }
866 
867  numEntries = palGDI->NumColors;
868  if (NULL != pe)
869  {
870  if (numEntries < StartIndex + Entries)
871  {
872  Entries = numEntries - StartIndex;
873  }
874  if (numEntries <= StartIndex)
875  {
877  return 0;
878  }
879  memcpy(pe, palGDI->IndexedColors + StartIndex, Entries * sizeof(PALETTEENTRY));
880  }
881  else
882  {
883  Entries = numEntries;
884  }
885 
887  return Entries;
888 }
struct _PALETTE * PPALETTE
PALETTEENTRY * IndexedColors
Definition: palette.h:42
smooth NULL
Definition: ftsmooth.c:557
#define PALETTE_ShareLockPalette(hpal)
Definition: palette.h:57
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ULONG NumColors
Definition: palette.h:41
LIST_ENTRY Entries[5]
Definition: ExDoubleList.c:8
#define PALETTE_ShareUnlockPalette(ppal)
Definition: palette.h:59
unsigned int UINT
Definition: ndis.h:50
UINT APIENTRY IntGetSystemPaletteEntries ( HDC  hDC,
UINT  StartIndex,
UINT  Entries,
LPPALETTEENTRY  pe 
)

Definition at line 891 of file palette.c.

Referenced by NtGdiDoPalette().

895 {
896  PPALETTE palGDI = NULL;
897  PDC dc = NULL;
898  UINT EntriesSize = 0;
899  UINT Ret = 0;
900 
901  if (Entries == 0)
902  {
904  return 0;
905  }
906 
907  if (pe != NULL)
908  {
909  EntriesSize = Entries * sizeof(pe[0]);
910  if (Entries != EntriesSize / sizeof(pe[0]))
911  {
912  /* Integer overflow! */
914  return 0;
915  }
916  }
917 
918  if (!(dc = DC_LockDc(hDC)))
919  {
921  return 0;
922  }
923 
924  palGDI = PALETTE_ShareLockPalette(dc->dclevel.hpal);
925  if (palGDI != NULL)
926  {
927  if (pe != NULL)
928  {
929  if (StartIndex >= palGDI->NumColors)
930  Entries = 0;
931  else if (Entries > palGDI->NumColors - StartIndex)
932  Entries = palGDI->NumColors - StartIndex;
933 
934  memcpy(pe,
935  palGDI->IndexedColors + StartIndex,
936  Entries * sizeof(pe[0]));
937 
938  Ret = Entries;
939  }
940  else
941  {
942  Ret = dc->ppdev->gdiinfo.ulNumPalReg;
943  }
944  }
945 
946  if (palGDI != NULL)
948 
949  if (dc != NULL)
950  DC_UnlockDc(dc);
951 
952  return Ret;
953 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
PALETTEENTRY * IndexedColors
Definition: palette.h:42
HDC dc
Definition: cylfrac.c:34
smooth NULL
Definition: ftsmooth.c:557
#define PALETTE_ShareLockPalette(hpal)
Definition: palette.h:57
HDC hDC
Definition: wglext.h:521
Definition: polytest.cpp:40
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ULONG NumColors
Definition: palette.h:41
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
LIST_ENTRY Entries[5]
Definition: ExDoubleList.c:8
#define PALETTE_ShareUnlockPalette(ppal)
Definition: palette.h:59
unsigned int UINT
Definition: ndis.h:50
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
UINT APIENTRY IntSetPaletteEntries ( HPALETTE  hpal,
UINT  Start,
UINT  Entries,
CONST LPPALETTEENTRY  pe 
)

Definition at line 957 of file palette.c.

Referenced by NtGdiDoPalette().

962 {
963  PPALETTE palGDI;
964  ULONG numEntries;
965 
966  if ((UINT)hpal & GDI_HANDLE_STOCK_MASK)
967  {
968  return 0;
969  }
970 
971  palGDI = PALETTE_ShareLockPalette(hpal);
972  if (!palGDI) return 0;
973 
974  numEntries = palGDI->NumColors;
975  if (Start >= numEntries)
976  {
978  return 0;
979  }
980  if (numEntries < Start + Entries)
981  {
982  Entries = numEntries - Start;
983  }
984  memcpy(palGDI->IndexedColors + Start, pe, Entries * sizeof(PALETTEENTRY));
986 
987  return Entries;
988 }
PALETTEENTRY * IndexedColors
Definition: palette.h:42
#define PALETTE_ShareLockPalette(hpal)
Definition: palette.h:57
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ULONG NumColors
Definition: palette.h:41
LIST_ENTRY Entries[5]
Definition: ExDoubleList.c:8
#define PALETTE_ShareUnlockPalette(ppal)
Definition: palette.h:59
unsigned int UINT
Definition: ndis.h:50
unsigned int ULONG
Definition: retypes.h:1
Definition: partlist.h:39
#define GDI_HANDLE_STOCK_MASK
Definition: gdi.h:19
HPALETTE APIENTRY NtGdiCreateHalftonePalette ( HDC  hDC)

Definition at line 515 of file palette.c.

516 {
517  int i, r, g, b;
518  PALETTEENTRY PalEntries[256];
519  PPALETTE ppal;
520  PDC pdc;
521  HPALETTE hpal = NULL;
522 
523  pdc = DC_LockDc(hDC);
524  if (!pdc)
525  {
527  return NULL;
528  }
529 
530  RtlZeroMemory(PalEntries, sizeof(PalEntries));
531 
532  /* First and last ten entries are default ones */
533  for (i = 0; i < 10; i++)
534  {
535  PalEntries[i].peRed = g_sysPalTemplate[i].peRed;
536  PalEntries[i].peGreen = g_sysPalTemplate[i].peGreen;
537  PalEntries[i].peBlue = g_sysPalTemplate[i].peBlue;
538 
539  PalEntries[246 + i].peRed = g_sysPalTemplate[10 + i].peRed;
540  PalEntries[246 + i].peGreen = g_sysPalTemplate[10 + i].peGreen;
541  PalEntries[246 + i].peBlue = g_sysPalTemplate[10 + i].peBlue;
542  }
543 
544  ppal = PALETTE_ShareLockPalette(pdc->dclevel.hpal);
545  if (ppal && (ppal->flFlags & PAL_INDEXED))
546  {
547  /* FIXME: optimize the palette for the current palette */
549  }
550  else
551  {
552  for (r = 0; r < 6; r++)
553  {
554  for (g = 0; g < 6; g++)
555  {
556  for (b = 0; b < 6; b++)
557  {
558  i = r + g*6 + b*36 + 10;
559  PalEntries[i].peRed = r * 51;
560  PalEntries[i].peGreen = g * 51;
561  PalEntries[i].peBlue = b * 51;
562  }
563  }
564  }
565 
566  for (i = 216; i < 246; i++)
567  {
568  int v = (i - 216) << 3;
569  PalEntries[i].peRed = v;
570  PalEntries[i].peGreen = v;
571  PalEntries[i].peBlue = v;
572  }
573  }
574 
575  if (ppal)
577 
578  DC_UnlockDc(pdc);
579 
580  ppal = PALETTE_AllocPalWithHandle(PAL_INDEXED, 256, PalEntries, 0, 0, 0);
581  if (ppal)
582  {
583  hpal = ppal->BaseObject.hHmgr;
584  PALETTE_UnlockPalette(ppal);
585  }
586 
587  return hpal;
588 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define PALETTE_UnlockPalette(pPalette)
Definition: palette.h:56
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
smooth NULL
Definition: ftsmooth.c:557
#define b
Definition: ke_i.h:79
#define PALETTE_ShareLockPalette(hpal)
Definition: palette.h:57
GLboolean GLboolean g
Definition: glext.h:6204
HDC hDC
Definition: wglext.h:521
Definition: polytest.cpp:40
PPALETTE NTAPI PALETTE_AllocPalWithHandle(_In_ ULONG iMode, _In_ ULONG cColors, _In_opt_ const PALETTEENTRY *pEntries, _In_ FLONG flRed, _In_ FLONG flGreen, _In_ FLONG flBlue)
Definition: palette.c:206
BASEOBJECT BaseObject
Definition: palette.h:36
FLONG flFlags
Definition: palette.h:40
const GLdouble * v
Definition: gl.h:2040
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define PALETTE_ShareUnlockPalette(ppal)
Definition: palette.h:59
#define UNIMPLEMENTED
Definition: debug.h:114
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
const PALETTEENTRY g_sysPalTemplate[NB_RESERVED_COLORS]
Definition: palette.c:20
HPALETTE APIENTRY NtGdiCreatePaletteInternal ( IN LPLOGPALETTE  plogpalUser,
IN UINT  cEntries 
)

Definition at line 474 of file palette.c.

Referenced by CreatePalette().

477 {
478  HPALETTE hpal = NULL;
479  PPALETTE ppal;
480  ULONG i, cjSize;
481 
483  if (ppal == NULL)
484  {
485  return NULL;
486  }
487 
488  cjSize = FIELD_OFFSET(LOGPALETTE, palPalEntry[cEntries]);
489 
490  _SEH2_TRY
491  {
492  ProbeForRead(plogpalUser, cjSize, 1);
493 
494  for (i = 0; i < cEntries; i++)
495  {
496  ppal->IndexedColors[i] = plogpalUser->palPalEntry[i];
497  }
498  }
500  {
502  _SEH2_YIELD(return NULL);
503  }
504  _SEH2_END;
505 
507  hpal = ppal->BaseObject.hHmgr;
508  PALETTE_UnlockPalette(ppal);
509 
510  return hpal;
511 }
PALETTEENTRY * IndexedColors
Definition: palette.h:42
VOID FASTCALL PALETTE_ValidateFlags(PALETTEENTRY *lpPalE, INT size)
Definition: palette.c:122
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define PALETTE_UnlockPalette(pPalette)
Definition: palette.h:56
#define _SEH2_END
Definition: pseh2_64.h:7
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
smooth NULL
Definition: ftsmooth.c:557
VOID NTAPI GDIOBJ_vDeleteObject(POBJ pobj)
Definition: gdiobj.c:1106
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
PPALETTE NTAPI PALETTE_AllocPalWithHandle(_In_ ULONG iMode, _In_ ULONG cColors, _In_opt_ const PALETTEENTRY *pEntries, _In_ FLONG flRed, _In_ FLONG flGreen, _In_ FLONG flBlue)
Definition: palette.c:206
_In_ UINT _In_ UINT cEntries
Definition: wingdi.h:3597
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
BASEOBJECT BaseObject
Definition: palette.h:36
#define _SEH2_TRY
Definition: pseh2_64.h:5
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
unsigned int ULONG
Definition: retypes.h:1
_In_ ULONG cjSize
Definition: winddi.h:3634
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
__kernel_entry LONG APIENTRY NtGdiDoPalette ( _In_ HGDIOBJ  hObj,
_In_ WORD  iStart,
_In_ WORD  cEntries,
_When_(bInbound!=0, _In_reads_bytes_(cEntries *sizeof(PALETTEENTRY))) _When_(bInbound==0, _Out_writes_bytes_(cEntries *sizeof(PALETTEENTRY))) LPVOID  pUnsafeEntries,
_In_ DWORD  iFunc,
_In_ BOOL  bInbound 
)

Definition at line 1074 of file palette.c.

Referenced by AnimatePalette(), GetDIBColorTable(), GetPaletteEntries(), GetSystemPaletteEntries(), SetDIBColorTable(), SetPaletteEntries(), Test_NtGdiDoPalette_GdiPalAnimate(), Test_NtGdiDoPalette_GdiPalGetEntries(), Test_NtGdiDoPalette_GdiPalSetEntries(), and Test_NtGdiDoPalette_SetDIBColorTable().

1082 {
1083  LONG ret;
1084  LPVOID pEntries = NULL;
1085  SIZE_T cjSize;
1086 
1087  if (pUnsafeEntries)
1088  {
1089  if (cEntries == 0)
1090  return 0;
1091 
1092  cjSize = cEntries * sizeof(PALETTEENTRY);
1093  pEntries = ExAllocatePoolWithTag(PagedPool, cjSize, TAG_PALETTE);
1094  if (!pEntries)
1095  return 0;
1096 
1097  if (bInbound)
1098  {
1099  _SEH2_TRY
1100  {
1101  ProbeForRead(pUnsafeEntries, cjSize, 1);
1102  memcpy(pEntries, pUnsafeEntries, cjSize);
1103  }
1105  {
1106  ExFreePoolWithTag(pEntries, TAG_PALETTE);
1107  _SEH2_YIELD(return 0);
1108  }
1109  _SEH2_END
1110  }
1111  else
1112  {
1113  /* Zero it out, so we don't accidentally leak kernel data */
1114  RtlZeroMemory(pEntries, cjSize);
1115  }
1116  }
1117 
1118  ret = 0;
1119  switch(iFunc)
1120  {
1121  case GdiPalAnimate:
1122  if (pEntries)
1123  ret = IntAnimatePalette((HPALETTE)hObj, iStart, cEntries, (CONST PPALETTEENTRY)pEntries);
1124  break;
1125 
1126  case GdiPalSetEntries:
1127  if (pEntries)
1128  ret = IntSetPaletteEntries((HPALETTE)hObj, iStart, cEntries, (CONST LPPALETTEENTRY)pEntries);
1129  break;
1130 
1131  case GdiPalGetEntries:
1132  ret = IntGetPaletteEntries((HPALETTE)hObj, iStart, cEntries, (LPPALETTEENTRY)pEntries);
1133  break;
1134 
1136  ret = IntGetSystemPaletteEntries((HDC)hObj, iStart, cEntries, (LPPALETTEENTRY)pEntries);
1137  break;
1138 
1139  case GdiPalSetColorTable:
1140  if (pEntries)
1141  ret = GreGetSetColorTable((HDC)hObj, iStart, cEntries, (RGBQUAD*)pEntries, TRUE);
1142  break;
1143 
1144  case GdiPalGetColorTable:
1145  if (pEntries)
1146  ret = GreGetSetColorTable((HDC)hObj, iStart, cEntries, (RGBQUAD*)pEntries, FALSE);
1147  break;
1148  }
1149 
1150  if (pEntries)
1151  {
1152  if (!bInbound && (ret > 0))
1153  {
1154  cjSize = min(cEntries, ret) * sizeof(PALETTEENTRY);
1155  _SEH2_TRY
1156  {
1157  ProbeForWrite(pUnsafeEntries, cjSize, 1);
1158  memcpy(pUnsafeEntries, pEntries, cjSize);
1159  }
1161  {
1162  ret = 0;
1163  }
1164  _SEH2_END
1165  }
1166  ExFreePoolWithTag(pEntries, TAG_PALETTE);
1167  }
1168 
1169  return ret;
1170 }
#define HDC
Definition: msvc.h:22
#define TRUE
Definition: types.h:120
UINT APIENTRY IntGetSystemPaletteEntries(HDC hDC, UINT StartIndex, UINT Entries, LPPALETTEENTRY pe)
Definition: palette.c:891
ULONG APIENTRY GreGetSetColorTable(HDC hdc, ULONG iStartIndex, ULONG cEntries, RGBQUAD *prgbColors, BOOL bSet)
Definition: palette.c:992
_In_ UINT iStart
Definition: wingdi.h:3597
UINT APIENTRY IntAnimatePalette(HPALETTE hPal, UINT StartIndex, UINT NumEntries, CONST PPALETTEENTRY PaletteColors)
Definition: palette.c:783
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
#define _SEH2_END
Definition: pseh2_64.h:7
UINT APIENTRY IntGetPaletteEntries(HPALETTE hpal, UINT StartIndex, UINT Entries, LPPALETTEENTRY pe)
Definition: palette.c:852
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:557
UINT APIENTRY IntSetPaletteEntries(HPALETTE hpal, UINT Start, UINT Entries, CONST LPPALETTEENTRY pe)
Definition: palette.c:957
#define CONST
Definition: compiler.h:170
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
_In_ UINT _In_ UINT cEntries
Definition: wingdi.h:3597
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
int ret
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define TAG_PALETTE
Definition: tags.h:26
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define _SEH2_TRY
Definition: pseh2_64.h:5
#define min(a, b)
Definition: monoChain.cc:55
_In_ ULONG cjSize
Definition: winddi.h:3634
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
struct tagPALETTEENTRY PALETTEENTRY
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1097
BOOL APIENTRY NtGdiGetColorAdjustment ( HDC  hdc,
LPCOLORADJUSTMENT  pca 
)

Definition at line 639 of file palette.c.

642 {
644  return FALSE;
645 }
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:114
COLORREF APIENTRY NtGdiGetNearestColor ( _In_ HDC  hDC,
_In_ COLORREF  Color 
)

FIXME: shouldn't dereference pSurface while the PDEV is not locked

Definition at line 659 of file palette.c.

662 {
663  COLORREF nearest = CLR_INVALID;
664  PDC dc;
665  EXLATEOBJ exlo;
666  PPALETTE ppal;
667 
668  dc = DC_LockDc(hDC);
669 
670  if(dc == NULL)
671  {
673  return CLR_INVALID;
674  }
675 
677  if(dc->dclevel.pSurface == NULL)
678  ppal = gppalMono;
679  else
680  ppal = dc->dclevel.pSurface->ppal;
681 
682  /* Translate the color to the DC format */
684 
685  /* XLATE it back to RGB color space */
686  EXLATEOBJ_vInitialize(&exlo,
687  ppal,
688  &gpalRGB,
689  0,
690  RGB(0xff, 0xff, 0xff),
691  RGB(0, 0, 0));
692 
693  nearest = XLATEOBJ_iXlate(&exlo.xlo, Color);
694 
695  EXLATEOBJ_vCleanup(&exlo);
696 
697  /* We're done */
698  DC_UnlockDc(dc);
699 
700  return nearest;
701 }
ULONG TranslateCOLORREF(PDC pdc, COLORREF crColor)
Definition: dcutil.c:860
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
PALETTE * gppalMono
Definition: palette.c:17
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define CLR_INVALID
Definition: wingdi.h:881
HDC dc
Definition: cylfrac.c:34
XLATEOBJ xlo
Definition: xlateobj.h:21
VOID NTAPI EXLATEOBJ_vInitialize(_Out_ PEXLATEOBJ pexlo, _In_opt_ PALETTE *ppalSrc, _In_opt_ PALETTE *ppalDst, _In_ COLORREF crSrcBackColor, _In_ COLORREF crDstBackColor, _In_ COLORREF crDstForeColor)
Definition: xlateobj.c:358
smooth NULL
Definition: ftsmooth.c:557
VOID NTAPI EXLATEOBJ_vCleanup(_Inout_ PEXLATEOBJ pexlo)
Definition: xlateobj.c:649
HDC hDC
Definition: wglext.h:521
Definition: polytest.cpp:40
#define RGB(r, g, b)
Definition: wingdi.h:2917
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
PALETTE gpalRGB
Definition: palette.c:17
ENGAPI ULONG APIENTRY XLATEOBJ_iXlate(_In_ XLATEOBJ *pxlo, _In_ ULONG iColor)
Definition: xlateobj.c:664
DWORD COLORREF
Definition: windef.h:313
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
UINT APIENTRY NtGdiGetNearestPaletteIndex ( HPALETTE  hpal,
COLORREF  crColor 
)

Definition at line 705 of file palette.c.

708 {
709  PPALETTE ppal = PALETTE_ShareLockPalette(hpal);
710  UINT index = 0;
711 
712  if (ppal)
713  {
714  if (ppal->flFlags & PAL_INDEXED)
715  {
716  /* Return closest match for the given RGB color */
717  index = PALETTE_ulGetNearestPaletteIndex(ppal, crColor);
718  }
719  // else SetLastError ?
721  }
722 
723  return index;
724 }
ULONG NTAPI PALETTE_ulGetNearestPaletteIndex(PALETTE *ppal, ULONG iColor)
Definition: palette.c:258
GLuint index
Definition: glext.h:6031
#define PALETTE_ShareLockPalette(hpal)
Definition: palette.h:57
#define index(s, c)
Definition: various.h:29
FLONG flFlags
Definition: palette.h:40
#define PALETTE_ShareUnlockPalette(ppal)
Definition: palette.h:59
unsigned int UINT
Definition: ndis.h:50
UINT APIENTRY NtGdiGetSystemPaletteUse ( HDC  hDC)

Definition at line 1200 of file palette.c.

1201 {
1202  return SystemPaletteUse;
1203 }
static UINT SystemPaletteUse
Definition: palette.c:15
BOOL APIENTRY NtGdiResizePalette ( HPALETTE  hpal,
UINT  Entries 
)

Definition at line 592 of file palette.c.

Referenced by ResizePalette().

595 {
596 /* PALOBJ *palPtr = (PALOBJ*)AccessUserObject(hPal);
597  UINT cPrevEnt, prevVer;
598  INT prevsize, size = sizeof(LOGPALETTE) + (cEntries - 1) * sizeof(PALETTEENTRY);
599  XLATEOBJ *XlateObj = NULL;
600 
601  if(!palPtr) return FALSE;
602  cPrevEnt = palPtr->logpalette->palNumEntries;
603  prevVer = palPtr->logpalette->palVersion;
604  prevsize = sizeof(LOGPALETTE) + (cPrevEnt - 1) * sizeof(PALETTEENTRY) + sizeof(int*) + sizeof(GDIOBJHDR);
605  size += sizeof(int*) + sizeof(GDIOBJHDR);
606  XlateObj = palPtr->logicalToSystem;
607 
608  if (!(palPtr = GDI_ReallocObject(size, hPal, palPtr))) return FALSE;
609 
610  if(XlateObj)
611  {
612  XLATEOBJ *NewXlateObj = (int*) HeapReAlloc(GetProcessHeap(), 0, XlateObj, cEntries * sizeof(int));
613  if(NewXlateObj == NULL)
614  {
615  ERR("Can not resize logicalToSystem -- out of memory!");
616  GDI_ReleaseObj( hPal );
617  return FALSE;
618  }
619  palPtr->logicalToSystem = NewXlateObj;
620  }
621 
622  if(cEntries > cPrevEnt)
623  {
624  if(XlateObj) memset(palPtr->logicalToSystem + cPrevEnt, 0, (cEntries - cPrevEnt)*sizeof(int));
625  memset( (BYTE*)palPtr + prevsize, 0, size - prevsize );
626  PALETTE_ValidateFlags((PALETTEENTRY*)((BYTE*)palPtr + prevsize), cEntries - cPrevEnt );
627  }
628  palPtr->logpalette->palNumEntries = cEntries;
629  palPtr->logpalette->palVersion = prevVer;
630 // GDI_ReleaseObj( hPal );
631  return TRUE; */
632 
634  return FALSE;
635 }
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:114
BOOL APIENTRY NtGdiSetColorAdjustment ( HDC  hdc,
LPCOLORADJUSTMENT  pca 
)

Definition at line 649 of file palette.c.

652 {
654  return FALSE;
655 }
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:114
UINT APIENTRY NtGdiSetSystemPaletteUse ( HDC  hDC,
UINT  Usage 
)

Definition at line 1173 of file palette.c.

1174 {
1175  UINT old = SystemPaletteUse;
1176 
1177  /* Device doesn't support colour palettes */
1179  return SYSPAL_ERROR;
1180  }
1181 
1182  switch (Usage)
1183  {
1184  case SYSPAL_NOSTATIC:
1185  case SYSPAL_NOSTATIC256:
1186  case SYSPAL_STATIC:
1188  break;
1189 
1190  default:
1191  old=SYSPAL_ERROR;
1192  break;
1193  }
1194 
1195  return old;
1196 }
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
Definition: hidpi.h:382
static UINT SystemPaletteUse
Definition: palette.c:15
#define SYSPAL_ERROR
Definition: wingdi.h:925
#define RASTERCAPS
Definition: wingdi.h:743
HDC hDC
Definition: wglext.h:521
#define SYSPAL_NOSTATIC256
Definition: wingdi.h:21
#define RC_PALETTE
Definition: wingdi.h:788
#define SYSPAL_STATIC
Definition: wingdi.h:924
#define SYSPAL_NOSTATIC
Definition: wingdi.h:923
unsigned int UINT
Definition: ndis.h:50
__kernel_entry W32KAPI INT APIENTRY NtGdiGetDeviceCaps(_In_ HDC hdc, _In_ INT i)
BOOL APIENTRY NtGdiUnrealizeObject ( HGDIOBJ  hgdiobj)

Definition at line 1244 of file palette.c.

1245 {
1246  BOOL Ret = FALSE;
1247  PPALETTE palGDI;
1248 
1249  if ( !hgdiobj ||
1250  ((UINT)hgdiobj & GDI_HANDLE_STOCK_MASK) ||
1252  return Ret;
1253 
1254  palGDI = PALETTE_ShareLockPalette(hgdiobj);
1255  if (!palGDI) return FALSE;
1256 
1257  // FIXME!!
1258  // Need to do something!!!
1259  // Zero out Current and Old Translated pointers?
1260  //
1261  Ret = TRUE;
1263  return Ret;
1264 }
#define GDI_HANDLE_IS_TYPE(h, t)
Definition: gdi.h:34
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GDI_OBJECT_TYPE_PALETTE
Definition: gdi.h:49
#define PALETTE_ShareLockPalette(hpal)
Definition: palette.h:57
unsigned int BOOL
Definition: ntddk_ex.h:94
#define PALETTE_ShareUnlockPalette(ppal)
Definition: palette.h:59
unsigned int UINT
Definition: ndis.h:50
#define GDI_HANDLE_STOCK_MASK
Definition: gdi.h:19
BOOL APIENTRY NtGdiUpdateColors ( HDC  hDC)

Definition at line 1207 of file palette.c.

Referenced by UpdateColors().

1208 {
1209  PWND Wnd;
1210  BOOL calledFromUser, ret;
1212 
1213  calledFromUser = UserIsEntered();
1214 
1215  if (!calledFromUser){
1217  }
1218 
1220  if (Wnd == NULL)
1221  {
1223 
1224  if (!calledFromUser){
1225  UserLeave();
1226  }
1227 
1228  return FALSE;
1229  }
1230 
1231  UserRefObjectCo(Wnd, &Ref);
1232  ret = co_UserRedrawWindow(Wnd, NULL, 0, RDW_INVALIDATE);
1233  UserDerefObjectCo(Wnd);
1234 
1235  if (!calledFromUser){
1236  UserLeave();
1237  }
1238 
1239  return ret;
1240 }
BOOL FASTCALL UserIsEntered(VOID)
Definition: ntuser.c:221
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
#define FALSE
Definition: types.h:117
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
Definition: object.h:3
smooth NULL
Definition: ftsmooth.c:557
HWND FASTCALL IntWindowFromDC(HDC hDc)
Definition: windc.c:893
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:243
HDC hDC
Definition: wglext.h:521
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
unsigned int BOOL
Definition: ntddk_ex.h:94
int ret
Definition: ntuser.h:657
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:251
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:895
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define RDW_INVALIDATE
Definition: winuser.h:1190
PPALETTE NTAPI PALETTE_AllocPalette ( _In_ ULONG  iMode,
_In_ ULONG  cColors,
_In_opt_ const PALETTEENTRY pEntries,
_In_ FLONG  flRed,
_In_ FLONG  flGreen,
_In_ FLONG  flBlue 
)

Definition at line 132 of file palette.c.

Referenced by CreateDIBPalette(), EngCreatePalette(), FixupDIBBrushPalette(), InitPaletteImpl(), and PALETTE_AllocPalWithHandle().

139 {
140  PPALETTE ppal;
141  ULONG fl = 0, cjSize = sizeof(PALETTE);
142 
143  /* Check if the palette has entries */
144  if (iMode & PAL_INDEXED)
145  {
146  /* Check color count */
147  if ((cColors == 0) || (cColors > 1024)) return NULL;
148 
149  /* Allocate enough space for the palete entries */
150  cjSize += cColors * sizeof(PALETTEENTRY);
151  }
152  else
153  {
154  /* There are no palette entries */
155  cColors = 0;
156 
157  /* We can use the lookaside list */
158  fl |= BASEFLAG_LOOKASIDE;
159  }
160 
161  /* Allocate the object (without a handle!) */
163  if (!ppal)
164  {
165  return NULL;
166  }
167 
168  /* Set mode, color count and entry pointer */
169  ppal->flFlags = iMode;
170  ppal->NumColors = cColors;
171  ppal->IndexedColors = ppal->apalColors;
172 
173  /* Check what kind of palette this is */
174  if (iMode & PAL_INDEXED)
175  {
176  /* Check if we got a color array */
177  if (pEntries)
178  {
179  /* Copy the entries */
180  RtlCopyMemory(ppal->IndexedColors, pEntries, cColors * sizeof(pEntries[0]));
181  }
182  }
183  else if (iMode & PAL_BITFIELDS)
184  {
185  /* Copy the color masks */
186  ppal->RedMask = flRed;
187  ppal->GreenMask = flGreen;
188  ppal->BlueMask = flBlue;
189 
190  /* Check what masks we have and set optimization flags */
191  if ((flRed == 0x7c00) && (flGreen == 0x3E0) && (flBlue == 0x1F))
192  ppal->flFlags |= PAL_RGB16_555;
193  else if ((flRed == 0xF800) && (flGreen == 0x7E0) && (flBlue == 0x1F))
194  ppal->flFlags |= PAL_RGB16_565;
195  else if ((flRed == 0xFF0000) && (flGreen == 0xFF00) && (flBlue == 0xFF))
196  ppal->flFlags |= PAL_BGR;
197  else if ((flRed == 0xFF) && (flGreen == 0xFF00) && (flBlue == 0xFF0000))
198  ppal->flFlags |= PAL_RGB;
199  }
200 
201  return ppal;
202 }
struct _PALETTE * PPALETTE
PALETTEENTRY apalColors[0]
Definition: palette.h:50
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
struct _PALETTE PALETTE
_In_ ULONG iMode
Definition: winddi.h:3520
PALETTEENTRY * IndexedColors
Definition: palette.h:42
_In_ FLONG fl
Definition: winddi.h:1279
ULONG RedMask
Definition: palette.h:43
smooth NULL
Definition: ftsmooth.c:557
ULONG BlueMask
Definition: palette.h:45
ULONG GreenMask
Definition: palette.h:44
ULONG NumColors
Definition: palette.h:41
FLONG flFlags
Definition: palette.h:40
unsigned int ULONG
Definition: retypes.h:1
_In_ ULONG cjSize
Definition: winddi.h:3634
struct tagPALETTEENTRY PALETTEENTRY
POBJ NTAPI GDIOBJ_AllocateObject(UCHAR objt, ULONG cjSize, FLONG fl)
Definition: gdiobj.c:557
PPALETTE NTAPI PALETTE_AllocPalWithHandle ( _In_ ULONG  iMode,
_In_ ULONG  cColors,
_In_opt_ const PALETTEENTRY pEntries,
_In_ FLONG  flRed,
_In_ FLONG  flGreen,
_In_ FLONG  flBlue 
)

Definition at line 206 of file palette.c.

Referenced by DIB_MapPaletteColors(), GreCreatePaletteInternal(), InitPaletteImpl(), NtGdiCreateHalftonePalette(), and NtGdiCreatePaletteInternal().

213 {
214  PPALETTE ppal;
215 
216  /* Allocate the palette without a handle */
217  ppal = PALETTE_AllocPalette(iMode, cColors, pEntries, flRed, flGreen, flBlue);
218  if (!ppal) return NULL;
219 
220  /* Insert the palette into the handle table */
222  {
223  DPRINT1("Could not insert palette into handle table.\n");
225  return NULL;
226  }
227 
228  return ppal;
229 }
_In_ ULONG iMode
Definition: winddi.h:3520
PPALETTE NTAPI PALETTE_AllocPalette(_In_ ULONG iMode, _In_ ULONG cColors, _In_opt_ const PALETTEENTRY *pEntries, _In_ FLONG flRed, _In_ FLONG flGreen, _In_ FLONG flBlue)
Definition: palette.c:132
smooth NULL
Definition: ftsmooth.c:557
BASEOBJECT BaseObject
Definition: palette.h:36
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
#define DPRINT1
Definition: precomp.h:8
VOID NTAPI GDIOBJ_vFreeObject(POBJ pobj)
Definition: gdiobj.c:591
HGDIOBJ NTAPI GDIOBJ_hInsertObject(POBJ pobj, ULONG ulOwner)
Definition: gdiobj.c:907
INT FASTCALL PALETTE_GetObject ( PPALETTE  ppal,
INT  cbCount,
LPLOGBRUSH  lpBuffer 
)

Definition at line 244 of file palette.c.

Referenced by GreGetObject().

245 {
246  if (!lpBuffer)
247  {
248  return sizeof(WORD);
249  }
250 
251  if ((UINT)cbCount < sizeof(WORD)) return 0;
252  *((WORD*)lpBuffer) = (WORD)ppal->NumColors;
253  return sizeof(WORD);
254 }
unsigned short WORD
Definition: ntddk_ex.h:93
static int cbCount
Definition: fiber.c:42
ULONG NumColors
Definition: palette.h:41
unsigned int UINT
Definition: ndis.h:50
ULONG NTAPI PALETTE_ulGetNearestBitFieldsIndex ( PALETTE ppal,
ULONG  ulColor 
)

Definition at line 291 of file palette.c.

Referenced by EXLATEOBJ_vInitialize(), and PALETTE_ulGetNearestIndex().

292 {
293  ULONG ulNewColor;
294 
295  // FIXME: HACK, should be stored already
296  ppal->ulRedShift = CalculateShift(RGB(0xff,0,0), ppal->RedMask);
297  ppal->ulGreenShift = CalculateShift(RGB(0,0xff,0), ppal->GreenMask);
298  ppal->ulBlueShift = CalculateShift(RGB(0,0,0xff), ppal->BlueMask);
299 
300  ulNewColor = _rotl(ulColor, ppal->ulRedShift) & ppal->RedMask;
301  ulNewColor |= _rotl(ulColor, ppal->ulGreenShift) & ppal->GreenMask;
302  ulNewColor |= _rotl(ulColor, ppal->ulBlueShift) & ppal->BlueMask;
303 
304  return ulNewColor;
305 }
ULONG ulBlueShift
Definition: palette.h:48
ULONG ulGreenShift
Definition: palette.h:47
ULONG ulRedShift
Definition: palette.h:46
ULONG RedMask
Definition: palette.h:43
ULONG BlueMask
Definition: palette.h:45
ULONG GreenMask
Definition: palette.h:44
#define RGB(r, g, b)
Definition: wingdi.h:2917
_Check_return_ unsigned int __cdecl _rotl(_In_ unsigned int _Value, _In_ int _Shift)
FORCEINLINE ULONG CalculateShift(ULONG ulMask1, ULONG ulMask2)
Definition: palette.h:130
unsigned int ULONG
Definition: retypes.h:1
ULONG NTAPI PALETTE_ulGetNearestIndex ( PALETTE ppal,
ULONG  ulColor 
)

Definition at line 309 of file palette.c.

Referenced by EXLATEOBJ_vInitialize(), and TranslateCOLORREF().

310 {
311  if (ppal->flFlags & PAL_INDEXED) // Use fl & PALINDEXED
312  return PALETTE_ulGetNearestPaletteIndex(ppal, ulColor);
313  else
314  return PALETTE_ulGetNearestBitFieldsIndex(ppal, ulColor);
315 }
ULONG NTAPI PALETTE_ulGetNearestPaletteIndex(PALETTE *ppal, ULONG iColor)
Definition: palette.c:258
FLONG flFlags
Definition: palette.h:40
ULONG NTAPI PALETTE_ulGetNearestBitFieldsIndex(PALETTE *ppal, ULONG ulColor)
Definition: palette.c:291
ULONG NTAPI PALETTE_ulGetNearestPaletteIndex ( PALETTE ppal,
ULONG  iColor 
)

Definition at line 258 of file palette.c.

Referenced by EXLATEOBJ_vInitialize(), NtGdiGetNearestPaletteIndex(), and PALETTE_ulGetNearestIndex().

259 {
260  ULONG ulDiff, ulColorDiff, ulMinimalDiff = 0xFFFFFF;
261  ULONG i, ulBestIndex = 0;
262  PALETTEENTRY peColor = *(PPALETTEENTRY)&iColor;
263 
264  /* Loop all palette entries */
265  for (i = 0; i < ppal->NumColors; i++)
266  {
267  /* Calculate distance in the color cube */
268  ulDiff = peColor.peRed - ppal->IndexedColors[i].peRed;
269  ulColorDiff = ulDiff * ulDiff;
270  ulDiff = peColor.peGreen - ppal->IndexedColors[i].peGreen;
271  ulColorDiff += ulDiff * ulDiff;
272  ulDiff = peColor.peBlue - ppal->IndexedColors[i].peBlue;
273  ulColorDiff += ulDiff * ulDiff;
274 
275  /* Check for a better match */
276  if (ulColorDiff < ulMinimalDiff)
277  {
278  ulBestIndex = i;
279  ulMinimalDiff = ulColorDiff;
280 
281  /* Break on exact match */
282  if (ulMinimalDiff == 0) break;
283  }
284  }
285 
286  return ulBestIndex;
287 }
PALETTEENTRY * IndexedColors
Definition: palette.h:42
GLenum GLclampf GLint i
Definition: glfuncs.h:14
ULONG NumColors
Definition: palette.h:41
unsigned int ULONG
Definition: retypes.h:1
struct tagPALETTEENTRY * PPALETTEENTRY
_In_ ULONG iColor
Definition: xlateobj.h:17
VOID FASTCALL PALETTE_ValidateFlags ( PALETTEENTRY lpPalE,
INT  size 
)

Definition at line 122 of file palette.c.

Referenced by GreCreatePaletteInternal(), IntAnimatePalette(), and NtGdiCreatePaletteInternal().

123 {
124  int i = 0;
125  for (; i<size ; i++)
126  lpPalE[i].peFlags = PC_SYS_USED | (lpPalE[i].peFlags & 0x07);
127 }
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define PC_SYS_USED
Definition: color.h:3
GLsizeiptr size
Definition: glext.h:5919
VOID NTAPI PALETTE_vCleanup ( PVOID  ObjectBody)

Definition at line 233 of file palette.c.

234 {
235  PPALETTE pPal = (PPALETTE)ObjectBody;
236  if (pPal->IndexedColors && pPal->IndexedColors != pPal->apalColors)
237  {
239  }
240 }
struct _PALETTE * PPALETTE
PALETTEENTRY apalColors[0]
Definition: palette.h:50
PALETTEENTRY * IndexedColors
Definition: palette.h:42
#define TAG_PALETTE
Definition: tags.h:26
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1097
VOID NTAPI PALETTE_vGetBitMasks ( PPALETTE  ppal,
PULONG  pulColors 
)

Definition at line 319 of file palette.c.

Referenced by EXLATEOBJ_vInitialize().

320 {
321  ASSERT(pulColors);
322 
323  if (ppal->flFlags & PAL_INDEXED || ppal->flFlags & PAL_RGB)
324  {
325  pulColors[0] = RGB(0xFF, 0x00, 0x00);
326  pulColors[1] = RGB(0x00, 0xFF, 0x00);
327  pulColors[2] = RGB(0x00, 0x00, 0xFF);
328  }
329  else if (ppal->flFlags & PAL_BGR)
330  {
331  pulColors[0] = RGB(0x00, 0x00, 0xFF);
332  pulColors[1] = RGB(0x00, 0xFF, 0x00);
333  pulColors[2] = RGB(0xFF, 0x00, 0x00);
334  }
335  else if (ppal->flFlags & PAL_BITFIELDS)
336  {
337  pulColors[0] = ppal->RedMask;
338  pulColors[1] = ppal->GreenMask;
339  pulColors[2] = ppal->BlueMask;
340  }
341 }
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
ULONG RedMask
Definition: palette.h:43
ULONG BlueMask
Definition: palette.h:45
ULONG GreenMask
Definition: palette.h:44
#define RGB(r, g, b)
Definition: wingdi.h:2917
FLONG flFlags
Definition: palette.h:40
ULONG APIENTRY PALOBJ_cGetColors ( PALOBJ PalObj,
ULONG  Start,
ULONG  Colors,
ULONG PaletteEntry 
)

Definition at line 420 of file palette.c.

Referenced by DrvSetPalette().

421 {
422  PALETTE *PalGDI;
423 
424  PalGDI = (PALETTE*)PalObj;
425 
426  if (Start >= PalGDI->NumColors)
427  return 0;
428 
429  Colors = min(Colors, PalGDI->NumColors - Start);
430 
431  /* NOTE: PaletteEntry ULONGs are in the same order as PALETTEENTRY. */
432  RtlCopyMemory(PaletteEntry, PalGDI->IndexedColors + Start, sizeof(ULONG) * Colors);
433 
434  if (PalGDI->flFlags & PAL_GAMMACORRECTION)
435  ColorCorrection(PalGDI, (PPALETTEENTRY)PaletteEntry, Colors);
436 
437  return Colors;
438 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
PALETTEENTRY * IndexedColors
Definition: palette.h:42
Colors
Definition: ansiprsr.h:4
ULONG NumColors
Definition: palette.h:41
FLONG flFlags
Definition: palette.h:40
#define min(a, b)
Definition: monoChain.cc:55
unsigned int ULONG
Definition: retypes.h:1
VOID FASTCALL ColorCorrection(PPALETTE PalGDI, PPALETTEENTRY PaletteEntry, ULONG Colors)
Definition: palette.c:345
Definition: partlist.h:39

Variable Documentation

PPALETTE appalSurfaceDefault[11]

Definition at line 18 of file palette.c.

Referenced by SURFACE_AllocSurface().

Initial value:
=
{
{ 0x00, 0x00, 0x00, PC_SYS_USED },
{ 0x80, 0x00, 0x00, PC_SYS_USED },
{ 0x00, 0x80, 0x00, PC_SYS_USED },
{ 0x80, 0x80, 0x00, PC_SYS_USED },
{ 0x00, 0x00, 0x80, PC_SYS_USED },
{ 0x80, 0x00, 0x80, PC_SYS_USED },
{ 0x00, 0x80, 0x80, PC_SYS_USED },
{ 0xc0, 0xc0, 0xc0, PC_SYS_USED },
{ 0xc0, 0xdc, 0xc0, PC_SYS_USED },
{ 0xa6, 0xca, 0xf0, PC_SYS_USED },
{ 0xff, 0xfb, 0xf0, PC_SYS_USED },
{ 0xa0, 0xa0, 0xa4, PC_SYS_USED },
{ 0x80, 0x80, 0x80, PC_SYS_USED },
{ 0xff, 0x00, 0x00, PC_SYS_USED },
{ 0x00, 0xff, 0x00, PC_SYS_USED },
{ 0xff, 0xff, 0x00, PC_SYS_USED },
{ 0x00, 0x00, 0xff, PC_SYS_USED },
{ 0xff, 0x00, 0xff, PC_SYS_USED },
{ 0x00, 0xff, 0xff, PC_SYS_USED },
{ 0xff, 0xff, 0xff, PC_SYS_USED }
}
#define PC_SYS_USED
Definition: color.h:3

Definition at line 20 of file palette.c.

PALETTE gpalBGR

Definition at line 17 of file palette.c.

Referenced by InitPaletteImpl().

PALETTE gpalRGB555

Definition at line 17 of file palette.c.

PALETTE gpalRGB565

Definition at line 17 of file palette.c.

Referenced by InitPaletteImpl().

PALETTE * gppalDefault

Definition at line 17 of file palette.c.

Referenced by CreateDIBPalette(), CreateStockObjects(), EBRUSHOBJ_vInit(), and InitPaletteImpl().

UINT SystemPaletteUse = SYSPAL_NOSTATIC
static

Definition at line 15 of file palette.c.

Referenced by NtGdiGetSystemPaletteUse(), and NtGdiSetSystemPaletteUse().