mirror of
https://github.com/reactos/reactos.git
synced 2025-05-08 19:27:00 +00:00
[FORMATTING]
palobj.c: Fix indentation, no code change. svn path=/trunk/; revision=41759
This commit is contained in:
parent
5110e854a6
commit
5fcc972751
1 changed files with 217 additions and 208 deletions
|
@ -34,7 +34,7 @@ int COLOR_gapEnd;
|
||||||
int COLOR_gapFilled;
|
int COLOR_gapFilled;
|
||||||
int COLOR_max;
|
int COLOR_max;
|
||||||
|
|
||||||
PPALETTEENTRY FASTCALL ReturnSystemPalette (VOID)
|
PPALETTEENTRY FASTCALL ReturnSystemPalette(VOID)
|
||||||
{
|
{
|
||||||
return COLOR_sysPal;
|
return COLOR_sysPal;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,9 @@ PALETTE_AllocPalette(ULONG Mode,
|
||||||
|
|
||||||
if (NULL != Colors)
|
if (NULL != Colors)
|
||||||
{
|
{
|
||||||
PalGDI->IndexedColors = ExAllocatePoolWithTag(PagedPool, sizeof(PALETTEENTRY) * NumColors, TAG_PALETTE);
|
PalGDI->IndexedColors = ExAllocatePoolWithTag(PagedPool,
|
||||||
|
sizeof(PALETTEENTRY) * NumColors,
|
||||||
|
TAG_PALETTE);
|
||||||
if (NULL == PalGDI->IndexedColors)
|
if (NULL == PalGDI->IndexedColors)
|
||||||
{
|
{
|
||||||
PALETTE_UnlockPalette(PalGDI);
|
PALETTE_UnlockPalette(PalGDI);
|
||||||
|
@ -122,13 +124,16 @@ PALETTE_AllocPaletteIndexedRGB(ULONG NumColors,
|
||||||
PalGDI->Self = NewPalette;
|
PalGDI->Self = NewPalette;
|
||||||
PalGDI->Mode = PAL_INDEXED;
|
PalGDI->Mode = PAL_INDEXED;
|
||||||
|
|
||||||
PalGDI->IndexedColors = ExAllocatePoolWithTag(PagedPool, sizeof(PALETTEENTRY) * NumColors, TAG_PALETTE);
|
PalGDI->IndexedColors = ExAllocatePoolWithTag(PagedPool,
|
||||||
|
sizeof(PALETTEENTRY) * NumColors,
|
||||||
|
TAG_PALETTE);
|
||||||
if (NULL == PalGDI->IndexedColors)
|
if (NULL == PalGDI->IndexedColors)
|
||||||
{
|
{
|
||||||
PALETTE_UnlockPalette(PalGDI);
|
PALETTE_UnlockPalette(PalGDI);
|
||||||
PALETTE_FreePaletteByHandle(NewPalette);
|
PALETTE_FreePaletteByHandle(NewPalette);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < NumColors; i++)
|
for (i = 0; i < NumColors; i++)
|
||||||
{
|
{
|
||||||
PalGDI->IndexedColors[i].peRed = Colors[i].rgbRed;
|
PalGDI->IndexedColors[i].peRed = Colors[i].rgbRed;
|
||||||
|
@ -156,12 +161,15 @@ HPALETTE FASTCALL PALETTE_Init(VOID)
|
||||||
const PALETTEENTRY* __sysPalTemplate = (const PALETTEENTRY*)COLOR_GetSystemPaletteTemplate();
|
const PALETTEENTRY* __sysPalTemplate = (const PALETTEENTRY*)COLOR_GetSystemPaletteTemplate();
|
||||||
|
|
||||||
// create default palette (20 system colors)
|
// create default palette (20 system colors)
|
||||||
palPtr = ExAllocatePoolWithTag(PagedPool, sizeof(LOGPALETTE) + (NB_RESERVED_COLORS * sizeof(PALETTEENTRY)), TAG_PALETTE);
|
palPtr = ExAllocatePoolWithTag(PagedPool,
|
||||||
|
sizeof(LOGPALETTE) +
|
||||||
|
(NB_RESERVED_COLORS * sizeof(PALETTEENTRY)),
|
||||||
|
TAG_PALETTE);
|
||||||
if (!palPtr) return FALSE;
|
if (!palPtr) return FALSE;
|
||||||
|
|
||||||
palPtr->palVersion = 0x300;
|
palPtr->palVersion = 0x300;
|
||||||
palPtr->palNumEntries = NB_RESERVED_COLORS;
|
palPtr->palNumEntries = NB_RESERVED_COLORS;
|
||||||
for(i=0; i<NB_RESERVED_COLORS; i++)
|
for (i=0; i<NB_RESERVED_COLORS; i++)
|
||||||
{
|
{
|
||||||
palPtr->palPalEntry[i].peRed = __sysPalTemplate[i].peRed;
|
palPtr->palPalEntry[i].peRed = __sysPalTemplate[i].peRed;
|
||||||
palPtr->palPalEntry[i].peGreen = __sysPalTemplate[i].peGreen;
|
palPtr->palPalEntry[i].peGreen = __sysPalTemplate[i].peGreen;
|
||||||
|
@ -185,7 +193,7 @@ HPALETTE FASTCALL PALETTE_Init(VOID)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* palette_size = visual->map_entries; */
|
/* palette_size = visual->map_entries; */
|
||||||
|
|
||||||
return hpalette;
|
return hpalette;
|
||||||
}
|
}
|
||||||
|
@ -199,9 +207,9 @@ static void FASTCALL PALETTE_FormatSystemPalette(void)
|
||||||
int i, j = PALETTE_firstFree = NB_RESERVED_COLORS/2;
|
int i, j = PALETTE_firstFree = NB_RESERVED_COLORS/2;
|
||||||
|
|
||||||
COLOR_sysPal[j].peFlags = 0;
|
COLOR_sysPal[j].peFlags = 0;
|
||||||
for(i = (NB_RESERVED_COLORS>>1) + 1 ; i < 256 - (NB_RESERVED_COLORS>>1) ; i++)
|
for (i = (NB_RESERVED_COLORS>>1) + 1 ; i < 256 - (NB_RESERVED_COLORS>>1) ; i++)
|
||||||
{
|
{
|
||||||
if( i < COLOR_gapStart || i > COLOR_gapEnd )
|
if (i < COLOR_gapStart || i > COLOR_gapEnd)
|
||||||
{
|
{
|
||||||
COLOR_sysPal[i].peFlags = 0; // unused tag
|
COLOR_sysPal[i].peFlags = 0; // unused tag
|
||||||
PALETTE_freeList[j] = i; // next
|
PALETTE_freeList[j] = i; // next
|
||||||
|
@ -215,7 +223,7 @@ static void FASTCALL PALETTE_FormatSystemPalette(void)
|
||||||
VOID FASTCALL PALETTE_ValidateFlags(PALETTEENTRY* lpPalE, INT size)
|
VOID FASTCALL PALETTE_ValidateFlags(PALETTEENTRY* lpPalE, INT size)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for( ; i<size ; i++ )
|
for (; i<size ; i++)
|
||||||
lpPalE[i].peFlags = PC_SYS_USED | (lpPalE[i].peFlags & 0x07);
|
lpPalE[i].peFlags = PC_SYS_USED | (lpPalE[i].peFlags & 0x07);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +247,7 @@ INT APIENTRY PALETTE_SetMapping(PALOBJ *palPtr, UINT uStart, UINT uNum, BOOL map
|
||||||
|
|
||||||
// reset dynamic system palette entries
|
// reset dynamic system palette entries
|
||||||
|
|
||||||
if( !mapOnly && PALETTE_firstFree != -1) PALETTE_FormatSystemPalette();
|
if (!mapOnly && PALETTE_firstFree != -1) PALETTE_FormatSystemPalette();
|
||||||
|
|
||||||
// initialize palette mapping table
|
// initialize palette mapping table
|
||||||
|
|
||||||
|
@ -256,17 +264,17 @@ INT APIENTRY PALETTE_SetMapping(PALOBJ *palPtr, UINT uStart, UINT uNum, BOOL map
|
||||||
|
|
||||||
palPtr->mapping = mapping;
|
palPtr->mapping = mapping;
|
||||||
|
|
||||||
for(uNum += uStart; uStart < uNum; uStart++)
|
for (uNum += uStart; uStart < uNum; uStart++)
|
||||||
{
|
{
|
||||||
index = -1;
|
index = -1;
|
||||||
flag = PC_SYS_USED;
|
flag = PC_SYS_USED;
|
||||||
|
|
||||||
switch( palGDI->IndexedColors[uStart].peFlags & 0x07 )
|
switch (palGDI->IndexedColors[uStart].peFlags & 0x07)
|
||||||
{
|
{
|
||||||
case PC_EXPLICIT: // palette entries are indices into system palette
|
case PC_EXPLICIT: // palette entries are indices into system palette
|
||||||
// The PC_EXPLICIT flag is used to copy an entry from the system palette into the logical palette
|
// The PC_EXPLICIT flag is used to copy an entry from the system palette into the logical palette
|
||||||
index = *(WORD*)(palGDI->IndexedColors + uStart);
|
index = *(WORD*)(palGDI->IndexedColors + uStart);
|
||||||
if(index > 255 || (index >= COLOR_gapStart && index <= COLOR_gapEnd))
|
if (index > 255 || (index >= COLOR_gapStart && index <= COLOR_gapEnd))
|
||||||
{
|
{
|
||||||
DbgPrint("Win32k: PC_EXPLICIT: idx %d out of system palette, assuming black.\n", index);
|
DbgPrint("Win32k: PC_EXPLICIT: idx %d out of system palette, assuming black.\n", index);
|
||||||
index = 0;
|
index = 0;
|
||||||
|
@ -290,12 +298,12 @@ INT APIENTRY PALETTE_SetMapping(PALOBJ *palPtr, UINT uStart, UINT uNum, BOOL map
|
||||||
|
|
||||||
DbgPrint("Win32k: WARNING: PC_NOCOLLAPSE is not yet working properly\n");
|
DbgPrint("Win32k: WARNING: PC_NOCOLLAPSE is not yet working properly\n");
|
||||||
|
|
||||||
if( index < 0 )
|
if (index < 0)
|
||||||
{
|
{
|
||||||
if(PALETTE_firstFree > 0 /* && !(PALETTE_PaletteFlags & PALETTE_FIXED) FIXME */ )
|
if (PALETTE_firstFree > 0 /* && !(PALETTE_PaletteFlags & PALETTE_FIXED) FIXME */)
|
||||||
{
|
{
|
||||||
DbgPrint("Win32k: Unimplemented Palette Operation: PC_NOCOLLAPSE [objects/palette.c]\n");
|
DbgPrint("Win32k: Unimplemented Palette Operation: PC_NOCOLLAPSE [objects/palette.c]\n");
|
||||||
/* XColor color;
|
/* XColor color;
|
||||||
index = PALETTE_firstFree; // ought to be available
|
index = PALETTE_firstFree; // ought to be available
|
||||||
PALETTE_firstFree = PALETTE_freeList[index];
|
PALETTE_firstFree = PALETTE_freeList[index];
|
||||||
|
|
||||||
|
@ -313,7 +321,7 @@ INT APIENTRY PALETTE_SetMapping(PALOBJ *palPtr, UINT uStart, UINT uNum, BOOL map
|
||||||
if(PALETTE_PaletteToXPixel) index = PALETTE_PaletteToXPixel[index]; */
|
if(PALETTE_PaletteToXPixel) index = PALETTE_PaletteToXPixel[index]; */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* else if (PALETTE_PaletteFlags & PALETTE_VIRTUAL)
|
/* else if (PALETTE_PaletteFlags & PALETTE_VIRTUAL)
|
||||||
{
|
{
|
||||||
index = PALETTE_ToPhysical(NULL, 0x00ffffff &
|
index = PALETTE_ToPhysical(NULL, 0x00ffffff &
|
||||||
*(COLORREF*)(palPtr->logpalette->palPalEntry + uStart));
|
*(COLORREF*)(palPtr->logpalette->palPalEntry + uStart));
|
||||||
|
@ -327,11 +335,11 @@ INT APIENTRY PALETTE_SetMapping(PALOBJ *palPtr, UINT uStart, UINT uNum, BOOL map
|
||||||
}
|
}
|
||||||
palGDI->IndexedColors[uStart].peFlags |= PC_SYS_USED;
|
palGDI->IndexedColors[uStart].peFlags |= PC_SYS_USED;
|
||||||
|
|
||||||
/* if(PALETTE_PaletteToXPixel) index = PALETTE_PaletteToXPixel[index]; FIXME */
|
/* if(PALETTE_PaletteToXPixel) index = PALETTE_PaletteToXPixel[index]; FIXME */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !prevMapping || palPtr->mapping[uStart] != index ) iRemapped++;
|
if (!prevMapping || palPtr->mapping[uStart] != index) iRemapped++;
|
||||||
palPtr->mapping[uStart] = index;
|
palPtr->mapping[uStart] = index;
|
||||||
}
|
}
|
||||||
return iRemapped;
|
return iRemapped;
|
||||||
|
@ -345,6 +353,7 @@ PALETTE_GetObject(PPALETTE pGdiObject, INT cbCount, LPLOGBRUSH lpBuffer)
|
||||||
{
|
{
|
||||||
return sizeof(WORD);
|
return sizeof(WORD);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((UINT)cbCount < sizeof(WORD)) return 0;
|
if ((UINT)cbCount < sizeof(WORD)) return 0;
|
||||||
*((WORD*)lpBuffer) = (WORD)pGdiObject->NumColors;
|
*((WORD*)lpBuffer) = (WORD)pGdiObject->NumColors;
|
||||||
return sizeof(WORD);
|
return sizeof(WORD);
|
||||||
|
|
Loading…
Reference in a new issue