diff --git a/reactos/win32ss/gdi/eng/engbrush.c b/reactos/win32ss/gdi/eng/engbrush.c index fcc03f1bce2..45acd94b13e 100644 --- a/reactos/win32ss/gdi/eng/engbrush.c +++ b/reactos/win32ss/gdi/eng/engbrush.c @@ -50,11 +50,15 @@ InitBrushImpl(VOID) VOID NTAPI -EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc) +EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, + PBRUSH pbrush, + PSURFACE psurf, + COLORREF crBackgroundClr, + COLORREF crForegroundClr, + PPALETTE ppalDC) { ASSERT(pebo); ASSERT(pbrush); - ASSERT(pdc); pebo->BrushObject.flColorType = 0; pebo->BrushObject.pvRbrush = NULL; @@ -63,20 +67,24 @@ EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc) pebo->flattrs = pbrush->flAttrs; /* Initialize 1 bpp fore and back colors */ - pebo->crCurrentBack = pdc->pdcattr->crBackgroundClr; - pebo->crCurrentText = pdc->pdcattr->crForegroundClr; + pebo->crCurrentBack = crBackgroundClr; + pebo->crCurrentText = crForegroundClr; - pebo->psurfTrg = pdc->dclevel.pSurface; + pebo->psurfTrg = psurf; /* We are initializing for a new memory DC */ if(!pebo->psurfTrg) pebo->psurfTrg = psurfDefaultBitmap; ASSERT(pebo->psurfTrg); ASSERT(pebo->psurfTrg->ppal); + /* Initialize palettes */ pebo->ppalSurf = pebo->psurfTrg->ppal; GDIOBJ_vReferenceObjectByPointer(&pebo->ppalSurf->BaseObject); - pebo->ppalDC = pdc->dclevel.ppal; + pebo->ppalDC = ppalDC; + if(!pebo->ppalDC) + pebo->ppalDC = gppalDefault; GDIOBJ_vReferenceObjectByPointer(&pebo->ppalDC->BaseObject); + pebo->ppalDIB = NULL; if (pbrush->flAttrs & BR_IS_NULL) { @@ -99,6 +107,16 @@ EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc) } } +VOID +NTAPI +EBRUSHOBJ_vInitFromDC(EBRUSHOBJ *pebo, + PBRUSH pbrush, PDC pdc) +{ + EBRUSHOBJ_vInit(pebo, pbrush, pdc->dclevel.pSurface, + pdc->pdcattr->crBackgroundClr, pdc->pdcattr->crForegroundClr, + pdc->dclevel.ppal); +} + VOID FASTCALL EBRUSHOBJ_vSetSolidRGBColor(EBRUSHOBJ *pebo, COLORREF crColor) @@ -157,13 +175,15 @@ EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo) VOID NTAPI -EBRUSHOBJ_vUpdate(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc) +EBRUSHOBJ_vUpdateFromDC(EBRUSHOBJ *pebo, + PBRUSH pbrush, + PDC pdc) { /* Cleanup the brush */ EBRUSHOBJ_vCleanup(pebo); /* Reinitialize */ - EBRUSHOBJ_vInit(pebo, pbrush, pdc); + EBRUSHOBJ_vInitFromDC(pebo, pbrush, pdc); } /** diff --git a/reactos/win32ss/gdi/ntgdi/bitblt.c b/reactos/win32ss/gdi/ntgdi/bitblt.c index e38b1c56f70..d8e5e67d3bd 100644 --- a/reactos/win32ss/gdi/ntgdi/bitblt.c +++ b/reactos/win32ss/gdi/ntgdi/bitblt.c @@ -853,7 +853,7 @@ IntGdiPolyPatBlt( if (pbrush != NULL) { /* Initialize a brush object */ - EBRUSHOBJ_vInit(&eboFill, pbrush, pdc); + EBRUSHOBJ_vInitFromDC(&eboFill, pbrush, pdc); IntPatBlt( pdc, diff --git a/reactos/win32ss/gdi/ntgdi/brush.h b/reactos/win32ss/gdi/ntgdi/brush.h index 78d5a10d4ed..69288aea614 100644 --- a/reactos/win32ss/gdi/ntgdi/brush.h +++ b/reactos/win32ss/gdi/ntgdi/brush.h @@ -98,6 +98,8 @@ BOOL NTAPI BRUSH_Cleanup(PVOID ObjectBody); extern HSURF gahsurfHatch[HS_DDI_MAX]; +struct _SURFACE; +struct _PALETTE; struct _DC; INIT_FUNCTION @@ -107,7 +109,11 @@ InitBrushImpl(VOID); VOID NTAPI -EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, struct _DC *); +EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, struct _SURFACE *, COLORREF, COLORREF, struct _PALETTE *); + +VOID +NTAPI +EBRUSHOBJ_vInitFromDC(EBRUSHOBJ *pebo, PBRUSH pbrush, struct _DC *); VOID FASTCALL @@ -115,7 +121,7 @@ EBRUSHOBJ_vSetSolidRGBColor(EBRUSHOBJ *pebo, COLORREF crColor); VOID NTAPI -EBRUSHOBJ_vUpdate(EBRUSHOBJ *pebo, PBRUSH pbrush, struct _DC *pdc); +EBRUSHOBJ_vUpdateFromDC(EBRUSHOBJ *pebo, PBRUSH pbrush, struct _DC *); BOOL NTAPI diff --git a/reactos/win32ss/gdi/ntgdi/dclife.c b/reactos/win32ss/gdi/ntgdi/dclife.c index 261cb16c343..66c709be861 100644 --- a/reactos/win32ss/gdi/ntgdi/dclife.c +++ b/reactos/win32ss/gdi/ntgdi/dclife.c @@ -270,10 +270,10 @@ DC_vInitDc( pdc->dcattr.ptlBrushOrigin = pdc->dclevel.ptlBrushOrigin; /* Initialize EBRUSHOBJs */ - EBRUSHOBJ_vInit(&pdc->eboFill, pdc->dclevel.pbrFill, pdc); - EBRUSHOBJ_vInit(&pdc->eboLine, pdc->dclevel.pbrLine, pdc); - EBRUSHOBJ_vInit(&pdc->eboText, pbrDefaultBrush, pdc); - EBRUSHOBJ_vInit(&pdc->eboBackground, pbrDefaultBrush, pdc); + EBRUSHOBJ_vInitFromDC(&pdc->eboFill, pdc->dclevel.pbrFill, pdc); + EBRUSHOBJ_vInitFromDC(&pdc->eboLine, pdc->dclevel.pbrLine, pdc); + EBRUSHOBJ_vInitFromDC(&pdc->eboText, pbrDefaultBrush, pdc); + EBRUSHOBJ_vInitFromDC(&pdc->eboBackground, pbrDefaultBrush, pdc); /* Setup fill data */ pdc->dcattr.jROP2 = R2_COPYPEN; diff --git a/reactos/win32ss/gdi/ntgdi/dcobjs.c b/reactos/win32ss/gdi/ntgdi/dcobjs.c index 370953f0c9d..db9bdbc8e06 100644 --- a/reactos/win32ss/gdi/ntgdi/dcobjs.c +++ b/reactos/win32ss/gdi/ntgdi/dcobjs.c @@ -43,7 +43,7 @@ DC_vUpdateFillBrush(PDC pdc) if (pdcattr->ulDirty_ & DIRTY_FILL) { /* Update eboFill */ - EBRUSHOBJ_vUpdate(&pdc->eboFill, pdc->dclevel.pbrFill, pdc); + EBRUSHOBJ_vUpdateFromDC(&pdc->eboFill, pdc->dclevel.pbrFill, pdc); } /* Check for DC brush */ @@ -90,7 +90,7 @@ DC_vUpdateLineBrush(PDC pdc) if (pdcattr->ulDirty_ & DIRTY_LINE) { /* Update eboLine */ - EBRUSHOBJ_vUpdate(&pdc->eboLine, pdc->dclevel.pbrLine, pdc); + EBRUSHOBJ_vUpdateFromDC(&pdc->eboLine, pdc->dclevel.pbrLine, pdc); } /* Check for DC pen */ @@ -113,7 +113,7 @@ DC_vUpdateTextBrush(PDC pdc) /* Timo : The text brush should never be changed. * Jérôme : Yeah, but its palette must be updated anyway! */ if(pdcattr->ulDirty_ & DIRTY_TEXT) - EBRUSHOBJ_vUpdate(&pdc->eboText, pbrDefaultBrush, pdc); + EBRUSHOBJ_vUpdateFromDC(&pdc->eboText, pbrDefaultBrush, pdc); /* Update the eboText's solid color */ EBRUSHOBJ_vSetSolidRGBColor(&pdc->eboText, pdcattr->crForegroundClr); @@ -129,7 +129,7 @@ DC_vUpdateBackgroundBrush(PDC pdc) PDC_ATTR pdcattr = pdc->pdcattr; if(pdcattr->ulDirty_ & DIRTY_BACKGROUND) - EBRUSHOBJ_vUpdate(&pdc->eboBackground, pbrDefaultBrush, pdc); + EBRUSHOBJ_vUpdateFromDC(&pdc->eboBackground, pbrDefaultBrush, pdc); /* Update the eboBackground's solid color */ EBRUSHOBJ_vSetSolidRGBColor(&pdc->eboBackground, pdcattr->crBackgroundClr);