mirror of
https://github.com/reactos/reactos.git
synced 2026-06-01 00:40:26 +08:00
[WIN32K:NTGDI] Fix pen color on 1BPP surfaces
The actual color is not nearest-matched (like for SetPixel), but the RGB color is matched against background color of the DC.
This commit is contained in:
@@ -132,20 +132,42 @@ EBRUSHOBJ_vSetSolidRGBColor(EBRUSHOBJ *pebo, COLORREF crColor)
|
||||
pebo->crRealize = crColor;
|
||||
pebo->ulRGBColor = crColor;
|
||||
|
||||
/* Initialize an XLATEOBJ RGB -> surface */
|
||||
EXLATEOBJ_vInitialize(&exlo,
|
||||
&gpalRGB,
|
||||
pebo->ppalSurf,
|
||||
pebo->crCurrentBack,
|
||||
0,
|
||||
0);
|
||||
/* Special handling for mono-surfaces */
|
||||
if (pebo->ppalSurf->flFlags & PAL_MONOCHROME)
|
||||
{
|
||||
/* Determine the indices for back and fore color */
|
||||
ULONG iBackIndex =
|
||||
PALETTE_ulGetNearestPaletteIndex(pebo->ppalSurf, pebo->crCurrentBack);
|
||||
ULONG iForeIndex = iBackIndex ^ 1;
|
||||
|
||||
/* Translate the brush color to the target format */
|
||||
iSolidColor = XLATEOBJ_iXlate(&exlo.xlo, crColor);
|
||||
pebo->BrushObject.iSolidColor = iSolidColor;
|
||||
/* Get the translated back color */
|
||||
ULONG rgbBack = PALETTE_ulGetRGBColorFromIndex(pebo->ppalSurf, iBackIndex);
|
||||
|
||||
/* Clean up the XLATEOBJ */
|
||||
EXLATEOBJ_vCleanup(&exlo);
|
||||
/* Match the pen color against RGB and translated background color */
|
||||
if ((crColor == rgbBack) || (crColor == pebo->crCurrentBack))
|
||||
pebo->BrushObject.iSolidColor = iBackIndex;
|
||||
else
|
||||
pebo->BrushObject.iSolidColor = iForeIndex;
|
||||
|
||||
pebo->flattrs |= BR_NEED_BK_CLR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Initialize an XLATEOBJ RGB -> surface */
|
||||
EXLATEOBJ_vInitialize(&exlo,
|
||||
&gpalRGB,
|
||||
pebo->ppalSurf,
|
||||
pebo->crCurrentBack,
|
||||
0,
|
||||
0);
|
||||
|
||||
/* Translate the brush color to the target format */
|
||||
iSolidColor = XLATEOBJ_iXlate(&exlo.xlo, crColor);
|
||||
pebo->BrushObject.iSolidColor = iSolidColor;
|
||||
|
||||
/* Clean up the XLATEOBJ */
|
||||
EXLATEOBJ_vCleanup(&exlo);
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
|
||||
@@ -80,8 +80,8 @@ typedef struct _EBRUSHOBJ
|
||||
COLORADJUSTMENT *pca;
|
||||
// DWORD dwUnknown2c;
|
||||
// DWORD dwUnknown30;
|
||||
SURFACE * psurfTrg;
|
||||
struct _PALETTE * ppalSurf;
|
||||
_Notnull_ SURFACE * psurfTrg;
|
||||
_Notnull_ struct _PALETTE * ppalSurf;
|
||||
struct _PALETTE * ppalDC;
|
||||
struct _PALETTE * ppalDIB;
|
||||
// DWORD dwUnknown44;
|
||||
|
||||
Reference in New Issue
Block a user