Author: jgardou Date: Thu Oct 18 18:23:47 2012 New Revision: 57571 URL: http://svn.reactos.org/svn/reactos?rev=57571&view=rev Log: [WIN32K] - Add the ability to initialize an EBRUSHOBJ object without a device context
Modified: trunk/reactos/win32ss/gdi/eng/engbrush.c trunk/reactos/win32ss/gdi/ntgdi/bitblt.c trunk/reactos/win32ss/gdi/ntgdi/brush.h trunk/reactos/win32ss/gdi/ntgdi/dclife.c trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c Modified: trunk/reactos/win32ss/gdi/eng/engbrush.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/engbrush.c?rev=57571&r1=57570&r2=57571&view=diff ============================================================================== --- trunk/reactos/win32ss/gdi/eng/engbrush.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/engbrush.c [iso-8859-1] Thu Oct 18 18:23:47 2012 @@ -50,11 +50,15 @@ 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 @@ pebo->flattrs = pbrush->flAttrs; /* Initialize 1 bpp fore and back colors */ - pebo->crCurrentBack = pdc->pdcattr->crBackgroundClr; - pebo->crCurrentText = pdc->pdcattr->crForegroundClr; - - pebo->psurfTrg = pdc->dclevel.pSurface; + pebo->crCurrentBack = crBackgroundClr; + pebo->crCurrentText = crForegroundClr; + + 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) { @@ -97,6 +105,16 @@ if (pbrush->flAttrs & BR_IS_HATCH) pebo->crCurrentText = pbrush->BrushAttr.lbColor; } +} + +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 @@ -157,13 +175,15 @@ 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); } /** Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitblt.c?rev=57571&r1=57570&r2=57571&view=diff ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] Thu Oct 18 18:23:47 2012 @@ -853,7 +853,7 @@ if (pbrush != NULL) { /* Initialize a brush object */ - EBRUSHOBJ_vInit(&eboFill, pbrush, pdc); + EBRUSHOBJ_vInitFromDC(&eboFill, pbrush, pdc); IntPatBlt( pdc, Modified: trunk/reactos/win32ss/gdi/ntgdi/brush.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/brush.h?rev=57571&r1=57570&r2=57571&view=diff ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/brush.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/brush.h [iso-8859-1] Thu Oct 18 18:23:47 2012 @@ -98,6 +98,8 @@ extern HSURF gahsurfHatch[HS_DDI_MAX]; +struct _SURFACE; +struct _PALETTE; struct _DC; INIT_FUNCTION @@ -107,7 +109,11 @@ 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 @@ VOID NTAPI -EBRUSHOBJ_vUpdate(EBRUSHOBJ *pebo, PBRUSH pbrush, struct _DC *pdc); +EBRUSHOBJ_vUpdateFromDC(EBRUSHOBJ *pebo, PBRUSH pbrush, struct _DC *); BOOL NTAPI Modified: trunk/reactos/win32ss/gdi/ntgdi/dclife.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dclife.c?rev=57571&r1=57570&r2=57571&view=diff ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dclife.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dclife.c [iso-8859-1] Thu Oct 18 18:23:47 2012 @@ -270,10 +270,10 @@ 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; Modified: trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c?rev=57571&r1=57570&r2=57571&view=diff ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c [iso-8859-1] Thu Oct 18 18:23:47 2012 @@ -43,7 +43,7 @@ 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 @@ 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 @@ /* 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 @@ 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);