Skip to content

Commit 950f079

Browse files
committed
scroll bar two
1 parent ce31161 commit 950f079

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

win32ss/gdi/eng/engbrush.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,20 @@ EBRUSHOBJ_vInit(EBRUSHOBJ *pebo,
6767
pebo->psoMask = NULL;
6868

6969
/* Initialize 1 bpp fore and back colors */
70-
pebo->crCurrentBack = crBackgroundClr;
71-
pebo->crCurrentText = crForegroundClr;
70+
/*
71+
* COLORREF uses only 24 bits (0x00BBGGRR).
72+
*
73+
* Note that 0xFFFFFFFF is CLR_INVALID in GDI, but we have also observed
74+
* some code paths feeding in ARGB values (e.g. 0xFFFFFFFF for opaque white).
75+
* We normalize to sane 24-bit defaults if we get CLR_INVALID, and otherwise
76+
* mask away any high byte to avoid sentinel collisions in drivers/ENG.
77+
*/
78+
79+
pebo->crCurrentBack = (crBackgroundClr == CLR_INVALID) ?
80+
0x00FFFFFF : (crBackgroundClr & 0x00FFFFFF);
81+
82+
pebo->crCurrentText = (crForegroundClr == CLR_INVALID) ?
83+
0x00000000 : (crForegroundClr & 0x00FFFFFF);
7284

7385
pebo->psurfTrg = psurf;
7486
/* We are initializing for a new memory DC */
@@ -103,7 +115,7 @@ EBRUSHOBJ_vInit(EBRUSHOBJ *pebo,
103115

104116
/* Use foreground color of hatch brushes */
105117
if (pbrush->flAttrs & BR_IS_HATCH)
106-
pebo->crCurrentText = pbrush->BrushAttr.lbColor;
118+
pebo->crCurrentText = pbrush->BrushAttr.lbColor & 0x00FFFFFF;
107119
}
108120
}
109121

0 commit comments

Comments
 (0)