mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 06:02:56 +00:00
[WIN32K]
- remove duplicate prototype - use RGB macro where possible - we create BGR palette for RGB DIB sections, let's do the other way around - simplify overcomplicated IntGetDIBColorTable - Add a first implementation of IntRealizePalette No, it's not the VLC icons bugfix svn path=/trunk/; revision=50928
This commit is contained in:
parent
ccebf72731
commit
5de8339cd1
5 changed files with 40 additions and 73 deletions
|
@ -232,8 +232,6 @@ IntGetSystemPaletteEntries(HDC hDC,
|
||||||
UINT StartIndex,
|
UINT StartIndex,
|
||||||
UINT Entries,
|
UINT Entries,
|
||||||
LPPALETTEENTRY pe);
|
LPPALETTEENTRY pe);
|
||||||
UINT APIENTRY
|
|
||||||
IntGetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, RGBQUAD *Colors);
|
|
||||||
|
|
||||||
UINT APIENTRY
|
UINT APIENTRY
|
||||||
IntSetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, CONST RGBQUAD *Colors);
|
IntSetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, CONST RGBQUAD *Colors);
|
||||||
|
|
|
@ -562,8 +562,8 @@ NtGdiMaskBlt(
|
||||||
NtGdiBitBlt(hdcBack, 0, 0, nWidth, nHeight, hdcDest, nXDest, nYDest, BKGND_ROP3(dwRop), 0, 0);
|
NtGdiBitBlt(hdcBack, 0, 0, nWidth, nHeight, hdcDest, nXDest, nYDest, BKGND_ROP3(dwRop), 0, 0);
|
||||||
|
|
||||||
/* 2.4 Erase the foreground pixels */
|
/* 2.4 Erase the foreground pixels */
|
||||||
IntGdiSetBkColor(hdcBack, 0xffffffff);
|
IntGdiSetBkColor(hdcBack, RGB(0xFF, 0xFF, 0xFF));
|
||||||
IntGdiSetTextColor(hdcBack, 0);
|
IntGdiSetTextColor(hdcBack, RGB(0, 0, 0));
|
||||||
NtGdiBitBlt(hdcBack, 0, 0, nWidth, nHeight, hdcMask, xMask, yMask, SRCAND, 0, 0);
|
NtGdiBitBlt(hdcBack, 0, 0, nWidth, nHeight, hdcMask, xMask, yMask, SRCAND, 0, 0);
|
||||||
|
|
||||||
/* 3. Create masked Foreground bitmap */
|
/* 3. Create masked Foreground bitmap */
|
||||||
|
@ -583,8 +583,8 @@ NtGdiMaskBlt(
|
||||||
NtGdiBitBlt(hdcFore, 0, 0, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, FRGND_ROP3(dwRop), 0,0);
|
NtGdiBitBlt(hdcFore, 0, 0, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, FRGND_ROP3(dwRop), 0,0);
|
||||||
|
|
||||||
/* 2.4 Erase the background pixels */
|
/* 2.4 Erase the background pixels */
|
||||||
IntGdiSetBkColor(hdcFore, 0);
|
IntGdiSetBkColor(hdcFore, RGB(0, 0, 0));
|
||||||
IntGdiSetTextColor(hdcFore, 0xffffffff);
|
IntGdiSetTextColor(hdcFore, RGB(0xFF, 0xFF, 0xFF));
|
||||||
NtGdiBitBlt(hdcFore, 0, 0, nWidth, nHeight, hdcMask, xMask, yMask, SRCAND, 0, 0);
|
NtGdiBitBlt(hdcFore, 0, 0, nWidth, nHeight, hdcMask, xMask, yMask, SRCAND, 0, 0);
|
||||||
|
|
||||||
/* 3. Combine the fore and background into the background bitmap */
|
/* 3. Combine the fore and background into the background bitmap */
|
||||||
|
|
|
@ -941,7 +941,7 @@ BITMAP_GetObject(SURFACE *psurf, INT Count, LPVOID buffer)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BMF_32BPP:
|
case BMF_32BPP:
|
||||||
if (psurf->ppal->flFlags & PAL_RGB)
|
if (psurf->ppal->flFlags & (PAL_RGB|PAL_BGR))
|
||||||
pds->dsBmih.biCompression = BI_RGB;
|
pds->dsBmih.biCompression = BI_RGB;
|
||||||
else
|
else
|
||||||
pds->dsBmih.biCompression = BI_BITFIELDS;
|
pds->dsBmih.biCompression = BI_BITFIELDS;
|
||||||
|
|
|
@ -193,9 +193,8 @@ IntGetDIBColorTable(
|
||||||
{
|
{
|
||||||
PDC dc;
|
PDC dc;
|
||||||
PSURFACE psurf;
|
PSURFACE psurf;
|
||||||
PPALETTE PalGDI;
|
PPALETTE ppal;
|
||||||
UINT Index, Count = 0;
|
UINT Index, Count = 0;
|
||||||
ULONG biBitCount;
|
|
||||||
|
|
||||||
if (!(dc = DC_LockDc(hDC))) return 0;
|
if (!(dc = DC_LockDc(hDC))) return 0;
|
||||||
if (dc->dctype == DC_TYPE_INFO)
|
if (dc->dctype == DC_TYPE_INFO)
|
||||||
|
@ -219,33 +218,22 @@ IntGetDIBColorTable(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
biBitCount = BitsPerFormat(psurf->SurfObj.iBitmapFormat);
|
ppal = psurf->ppal;
|
||||||
if (biBitCount <= 8 &&
|
ASSERT(ppal);
|
||||||
StartIndex < (1 << biBitCount))
|
|
||||||
{
|
|
||||||
if (StartIndex + Entries > (1 << biBitCount))
|
|
||||||
Entries = (1 << biBitCount) - StartIndex;
|
|
||||||
|
|
||||||
if (psurf->ppal == NULL)
|
if (ppal->flFlags & PAL_INDEXED)
|
||||||
{
|
{
|
||||||
DC_UnlockDc(dc);
|
|
||||||
EngSetLastError(ERROR_INVALID_HANDLE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
PalGDI = PALETTE_LockPalette(psurf->ppal->BaseObject.hHmgr);
|
|
||||||
|
|
||||||
for (Index = StartIndex;
|
for (Index = StartIndex;
|
||||||
Index < StartIndex + Entries && Index < PalGDI->NumColors;
|
Index < StartIndex + Entries && Index < ppal->NumColors;
|
||||||
Index++)
|
Index++)
|
||||||
{
|
{
|
||||||
Colors[Index - StartIndex].rgbRed = PalGDI->IndexedColors[Index].peRed;
|
Colors[Index - StartIndex].rgbRed = ppal->IndexedColors[Index].peRed;
|
||||||
Colors[Index - StartIndex].rgbGreen = PalGDI->IndexedColors[Index].peGreen;
|
Colors[Index - StartIndex].rgbGreen = ppal->IndexedColors[Index].peGreen;
|
||||||
Colors[Index - StartIndex].rgbBlue = PalGDI->IndexedColors[Index].peBlue;
|
Colors[Index - StartIndex].rgbBlue = ppal->IndexedColors[Index].peBlue;
|
||||||
Colors[Index - StartIndex].rgbReserved = 0;
|
Colors[Index - StartIndex].rgbReserved = 0;
|
||||||
Count++;
|
Count++;
|
||||||
}
|
}
|
||||||
PALETTE_UnlockPalette(PalGDI);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DC_UnlockDc(dc);
|
DC_UnlockDc(dc);
|
||||||
|
|
|
@ -725,58 +725,39 @@ UINT
|
||||||
FASTCALL
|
FASTCALL
|
||||||
IntGdiRealizePalette(HDC hDC)
|
IntGdiRealizePalette(HDC hDC)
|
||||||
{
|
{
|
||||||
/*
|
UINT i, realize = 0;
|
||||||
* This function doesn't do any real work now and there's plenty
|
PDC pdc;
|
||||||
* of bugs in it.
|
PALETTE *ppalSurf, *ppalDC;
|
||||||
*/
|
|
||||||
|
|
||||||
PPALETTE palGDI, sysGDI;
|
pdc = DC_LockDc(hDC);
|
||||||
int realized = 0;
|
if(!pdc)
|
||||||
PDC dc;
|
|
||||||
HPALETTE systemPalette;
|
|
||||||
|
|
||||||
dc = DC_LockDc(hDC);
|
|
||||||
if (!dc) return 0;
|
|
||||||
|
|
||||||
systemPalette = NtGdiGetStockObject(DEFAULT_PALETTE);
|
|
||||||
palGDI = PALETTE_LockPalette(dc->dclevel.hpal);
|
|
||||||
|
|
||||||
if (palGDI == NULL)
|
|
||||||
{
|
{
|
||||||
DPRINT1("IntGdiRealizePalette(): palGDI is NULL, exiting\n");
|
EngSetLastError(ERROR_INVALID_HANDLE);
|
||||||
DC_UnlockDc(dc);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sysGDI = PALETTE_LockPalette(systemPalette);
|
ppalSurf = pdc->dclevel.pSurface->ppal;
|
||||||
|
ppalDC = pdc->dclevel.ppal;
|
||||||
|
|
||||||
if (sysGDI == NULL)
|
if(!(ppalSurf->flFlags & PAL_INDEXED))
|
||||||
{
|
{
|
||||||
DPRINT1("IntGdiRealizePalette(): sysGDI is NULL, exiting\n");
|
// FIXME : set error?
|
||||||
PALETTE_UnlockPalette(palGDI);
|
goto cleanup;
|
||||||
DC_UnlockDc(dc);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The RealizePalette function modifies the palette for the device associated with the specified device context. If the
|
ASSERT(ppalDC->flFlags & PAL_INDEXED);
|
||||||
// device context is a memory DC, the color table for the bitmap selected into the DC is modified. If the device
|
|
||||||
// context is a display DC, the physical palette for that device is modified.
|
// FIXME : should we resize ppalSurf if it's too small?
|
||||||
if(dc->dctype == DC_TYPE_MEMORY)
|
realize = (ppalDC->NumColors < ppalSurf->NumColors) ? ppalDC->NumColors : ppalSurf->NumColors;
|
||||||
|
|
||||||
|
for(i=0; i<realize; i++)
|
||||||
{
|
{
|
||||||
// Memory managed DC
|
InterlockedExchange((LONG*)&ppalSurf->IndexedColors[i], *(LONG*)&ppalDC->IndexedColors[i]);
|
||||||
DPRINT1("RealizePalette unimplemented for memory managed DCs\n");
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
DPRINT1("RealizePalette unimplemented for device DCs\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// need to pass this to IntEngCreateXlate with palettes unlocked
|
cleanup:
|
||||||
PALETTE_UnlockPalette(sysGDI);
|
DC_UnlockDc(pdc);
|
||||||
PALETTE_UnlockPalette(palGDI);
|
return realize;
|
||||||
|
|
||||||
DC_UnlockDc(dc);
|
|
||||||
|
|
||||||
return realized;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT APIENTRY
|
UINT APIENTRY
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue