win32k brush update:

- fix EBRUSHOBJ_vSetSolidBrushColor
- Initialize text and background brush in DC_AllocDC
- Update the DCs EBRUSHOBJs on demand
- Use the DCs EBRUSHOBJs for drawing where appropriate
This makes things faster and finally adds support for DC_BRUSH and DC_PEN

svn path=/trunk/; revision=40306
This commit is contained in:
Timo Kreuzer 2009-04-01 01:49:18 +00:00
parent d3c4569552
commit 189fc82964
13 changed files with 192 additions and 336 deletions

View file

@ -111,11 +111,21 @@ EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, XLATEOBJ *pxlo)
VOID VOID
FASTCALL FASTCALL
EBRUSHOBJ_vSetSolidBrushColor(EBRUSHOBJ *pebo, ULONG iSolidColor) EBRUSHOBJ_vSetSolidBrushColor(EBRUSHOBJ *pebo, COLORREF crColor, XLATEOBJ *pxlo)
{ {
ULONG iSolidColor;
/* Never use with non-solid brushes */ /* Never use with non-solid brushes */
ASSERT(pebo->flattrs & GDIBRUSH_IS_SOLID); ASSERT(pebo->flattrs & GDIBRUSH_IS_SOLID);
/* Set the RGB color */
pebo->crRealize = crColor;
pebo->ulRGBColor = crColor;
/* Translate the brush color to the target format */
iSolidColor = XLATEOBJ_iXlate(pxlo, crColor);
pebo->BrushObject.iSolidColor = iSolidColor;
pebo->BrushObject.iSolidColor = iSolidColor; pebo->BrushObject.iSolidColor = iSolidColor;
} }
@ -169,7 +179,7 @@ EBRUSHOBJ_vUnrealizeBrush(EBRUSHOBJ *pebo)
/* Check if it's a GDI realisation */ /* Check if it's a GDI realisation */
if (pebo->pengbrush) if (pebo->pengbrush)
{ {
EngDeleteSurface(pebo->pengbrush);
} }
else if (pebo->BrushObject.pvRbrush) else if (pebo->BrushObject.pvRbrush)
{ {

View file

@ -110,7 +110,7 @@ EBRUSHOBJ_vInit(EBRUSHOBJ *BrushInst, PBRUSH BrushObj, XLATEOBJ *XlateObj);
VOID VOID
FASTCALL FASTCALL
EBRUSHOBJ_vSetSolidBrushColor(EBRUSHOBJ *pebo, ULONG iSolidColor); EBRUSHOBJ_vSetSolidBrushColor(EBRUSHOBJ *pebo, COLORREF crColor, XLATEOBJ *pxlo);
VOID VOID
FASTCALL FASTCALL

View file

@ -246,6 +246,10 @@ VOID FASTCALL DC_UpdateXforms(PDC dc);
BOOL FASTCALL DC_InvertXform(const XFORM *xformSrc, XFORM *xformDest); BOOL FASTCALL DC_InvertXform(const XFORM *xformSrc, XFORM *xformDest);
VOID FASTCALL DC_vUpdateViewportExt(PDC pdc); VOID FASTCALL DC_vUpdateViewportExt(PDC pdc);
VOID FASTCALL DC_vCopyState(PDC pdcSrc, PDC pdcDst); VOID FASTCALL DC_vCopyState(PDC pdcSrc, PDC pdcDst);
VOID FASTCALL DC_vUpdateFillBrush(PDC pdc);
VOID FASTCALL DC_vUpdateLineBrush(PDC pdc);
VOID FASTCALL DC_vUpdateTextBrush(PDC pdc);
VOID FASTCALL DC_vUpdateBackgroundBrush(PDC pdc);
BOOL FASTCALL DCU_SyncDcAttrtoUser(PDC); BOOL FASTCALL DCU_SyncDcAttrtoUser(PDC);
BOOL FASTCALL DCU_SynchDcAttrtoUser(HDC); BOOL FASTCALL DCU_SynchDcAttrtoUser(HDC);

View file

@ -165,8 +165,6 @@ IntArc( DC *dc,
return FALSE; return FALSE;
} }
EBRUSHOBJ_vInit(&dc->eboLine, pbrushPen, dc->rosdc.XlatePen);
if (arctype == GdiTypePie) if (arctype == GdiTypePie)
{ {
PUTLINE(CenterX, CenterY, SfCx + CenterX, SfCy + CenterY, dc->eboLine); PUTLINE(CenterX, CenterY, SfCx + CenterX, SfCy + CenterY, dc->eboLine);
@ -222,11 +220,11 @@ IntGdiArcInternal(
pdcattr = dc->pdcattr; pdcattr = dc->pdcattr;
if (pdcattr->ulDirty_ & DC_BRUSH_DIRTY) if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
IntGdiSelectBrush(dc,pdcattr->hbrush); DC_vUpdateFillBrush(dc);
if (pdcattr->ulDirty_ & DC_PEN_DIRTY) if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
IntGdiSelectPen(dc,pdcattr->hpen); DC_vUpdateLineBrush(dc);
if (arctype == GdiTypeArcTo) if (arctype == GdiTypeArcTo)
{ {

View file

@ -192,10 +192,7 @@ NtGdiBitBlt(
POINTL SourcePoint, BrushOrigin; POINTL SourcePoint, BrushOrigin;
BOOL Status = FALSE; BOOL Status = FALSE;
XLATEOBJ *XlateObj = NULL; XLATEOBJ *XlateObj = NULL;
PBRUSH pbrush = NULL;
EBRUSHOBJ BrushInst;
BOOL UsesSource = ROP3_USES_SOURCE(ROP); BOOL UsesSource = ROP3_USES_SOURCE(ROP);
BOOL UsesPattern = ROP3_USES_PATTERN(ROP);
DCDest = DC_LockDc(hDCDest); DCDest = DC_LockDc(hDCDest);
if (NULL == DCDest) if (NULL == DCDest)
@ -237,8 +234,8 @@ NtGdiBitBlt(
pdcattr = DCDest->pdcattr; pdcattr = DCDest->pdcattr;
if (pdcattr->ulDirty_ & DC_BRUSH_DIRTY) if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
IntGdiSelectBrush(DCDest,pdcattr->hbrush); DC_vUpdateFillBrush(DCDest);
/* Offset the destination and source by the origin of their DCs. */ /* Offset the destination and source by the origin of their DCs. */
XDest += DCDest->ptlDCOrig.x; XDest += DCDest->ptlDCOrig.x;
@ -283,18 +280,6 @@ NtGdiBitBlt(
} }
} }
if (UsesPattern)
{
pbrush = BRUSH_LockBrush(pdcattr->hbrush);
if (NULL == pbrush)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
goto cleanup;
}
BrushOrigin = *((PPOINTL)&pbrush->ptOrigin);
EBRUSHOBJ_vInit(&BrushInst, pbrush, DCDest->rosdc.XlateBrush);
}
/* Create the XLATEOBJ. */ /* Create the XLATEOBJ. */
if (UsesSource) if (UsesSource)
{ {
@ -310,11 +295,17 @@ NtGdiBitBlt(
} }
/* Perform the bitblt operation */ /* Perform the bitblt operation */
Status = IntEngBitBlt(&BitmapDest->SurfObj, BitmapSrc ? &BitmapSrc->SurfObj : NULL, NULL, Status = IntEngBitBlt(&BitmapDest->SurfObj,
DCDest->rosdc.CombinedClip, XlateObj, &DestRect, BitmapSrc ? &BitmapSrc->SurfObj : NULL,
&SourcePoint, NULL, NULL,
pbrush ? &BrushInst.BrushObject : NULL, DCDest->rosdc.CombinedClip,
&BrushOrigin, ROP3_TO_ROP4(ROP)); XlateObj,
&DestRect,
&SourcePoint,
NULL,
&DCDest->eboFill.BrushObject,
&DCDest->dclevel.pbrFill->ptOrigin,
ROP3_TO_ROP4(ROP));
cleanup: cleanup:
if (UsesSource && XlateObj != NULL) if (UsesSource && XlateObj != NULL)
@ -328,10 +319,6 @@ cleanup:
{ {
SURFACE_UnlockSurface(BitmapSrc); SURFACE_UnlockSurface(BitmapSrc);
} }
if (pbrush != NULL)
{
BRUSH_UnlockBrush(pbrush);
}
if (UsesSource && hDCSrc != hDCDest) if (UsesSource && hDCSrc != hDCDest)
{ {
DC_UnlockDc(DCSrc); DC_UnlockDc(DCSrc);
@ -756,10 +743,7 @@ NtGdiStretchBlt(
BOOL Status = FALSE; BOOL Status = FALSE;
XLATEOBJ *XlateObj = NULL; XLATEOBJ *XlateObj = NULL;
POINTL BrushOrigin; POINTL BrushOrigin;
PBRUSH pbrush = NULL;
EBRUSHOBJ BrushInst;
BOOL UsesSource = ROP3_USES_SOURCE(ROP); BOOL UsesSource = ROP3_USES_SOURCE(ROP);
BOOL UsesPattern = ROP3_USES_PATTERN(ROP);
if (0 == WidthDest || 0 == HeightDest || 0 == WidthSrc || 0 == HeightSrc) if (0 == WidthDest || 0 == HeightDest || 0 == WidthSrc || 0 == HeightSrc)
{ {
@ -808,8 +792,8 @@ NtGdiStretchBlt(
pdcattr = DCDest->pdcattr; pdcattr = DCDest->pdcattr;
if (pdcattr->ulDirty_ & DC_BRUSH_DIRTY) if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
IntGdiSelectBrush(DCDest,pdcattr->hbrush); DC_vUpdateFillBrush(DCDest);
/* Offset the destination and source by the origin of their DCs. */ /* Offset the destination and source by the origin of their DCs. */
XOriginDest += DCDest->ptlDCOrig.x; XOriginDest += DCDest->ptlDCOrig.x;
@ -865,38 +849,28 @@ NtGdiStretchBlt(
} }
} }
if (UsesPattern)
{
pbrush = BRUSH_LockBrush(pdcattr->hbrush);
if (NULL == pbrush)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
goto failed;
}
BrushOrigin = *((PPOINTL)&pbrush->ptOrigin);
EBRUSHOBJ_vInit(&BrushInst, pbrush, DCDest->rosdc.XlateBrush);
}
/* Offset the brush */ /* Offset the brush */
BrushOrigin.x += DCDest->ptlDCOrig.x; BrushOrigin.x += DCDest->ptlDCOrig.x;
BrushOrigin.y += DCDest->ptlDCOrig.y; BrushOrigin.y += DCDest->ptlDCOrig.y;
/* Perform the bitblt operation */ /* Perform the bitblt operation */
Status = IntEngStretchBlt(&BitmapDest->SurfObj, &BitmapSrc->SurfObj, Status = IntEngStretchBlt(&BitmapDest->SurfObj,
NULL, DCDest->rosdc.CombinedClip, XlateObj, &BitmapSrc->SurfObj,
&DestRect, &SourceRect, NULL, NULL,
pbrush ? &BrushInst.BrushObject : NULL, DCDest->rosdc.CombinedClip,
&BrushOrigin, ROP3_TO_ROP4(ROP)); XlateObj,
&DestRect,
&SourceRect,
NULL,
&DCDest->eboFill.BrushObject,
&BrushOrigin,
ROP3_TO_ROP4(ROP));
failed: failed:
if (XlateObj) if (XlateObj)
{ {
EngDeleteXlate(XlateObj); EngDeleteXlate(XlateObj);
} }
if (pbrush)
{
BRUSH_UnlockBrush(pbrush);
}
if (BitmapSrc && DCSrc->rosdc.hBitmap != DCDest->rosdc.hBitmap) if (BitmapSrc && DCSrc->rosdc.hBitmap != DCDest->rosdc.hBitmap)
{ {
SURFACE_UnlockSurface(BitmapSrc); SURFACE_UnlockSurface(BitmapSrc);

View file

@ -22,6 +22,7 @@ DC_AllocDC(PUNICODE_STRING Driver)
HDC hDC; HDC hDC;
PWSTR Buf = NULL; PWSTR Buf = NULL;
XFORM xformTemplate; XFORM xformTemplate;
PBRUSH pbrush;
if (Driver != NULL) if (Driver != NULL)
{ {
@ -104,8 +105,16 @@ DC_AllocDC(PUNICODE_STRING Driver)
/* Create the default pen / line brush */ /* Create the default pen / line brush */
pdcattr->hpen = NtGdiGetStockObject(BLACK_PEN); pdcattr->hpen = NtGdiGetStockObject(BLACK_PEN);
NewDC->dclevel.pbrLine = PEN_ShareLockPen(pdcattr->hpen); NewDC->dclevel.pbrLine = PEN_ShareLockPen(pdcattr->hpen);
EBRUSHOBJ_vInit(&NewDC->eboLine, NewDC->dclevel.pbrFill, NULL); EBRUSHOBJ_vInit(&NewDC->eboLine, NewDC->dclevel.pbrLine, NULL);
/* Create the default text brush */
pbrush = BRUSH_ShareLockBrush(NtGdiGetStockObject(BLACK_BRUSH));
EBRUSHOBJ_vInit(&NewDC->eboText, pbrush, NULL);
pdcattr->ulDirty_ |= DIRTY_TEXT;
/* Create the default background brush */
pbrush = BRUSH_ShareLockBrush(NtGdiGetStockObject(WHITE_BRUSH));
EBRUSHOBJ_vInit(&NewDC->eboBackground, pbrush, NULL);
pdcattr->hlfntNew = NtGdiGetStockObject(SYSTEM_FONT); pdcattr->hlfntNew = NtGdiGetStockObject(SYSTEM_FONT);
TextIntRealizeFont(pdcattr->hlfntNew,NULL); TextIntRealizeFont(pdcattr->hlfntNew,NULL);
@ -149,6 +158,10 @@ DC_Cleanup(PVOID ObjectBody)
DC_vSelectFillBrush(pDC, NULL); DC_vSelectFillBrush(pDC, NULL);
DC_vSelectLineBrush(pDC, NULL); DC_vSelectLineBrush(pDC, NULL);
/* Dereference default brushes */
BRUSH_ShareUnlockBrush(pDC->eboText.pbrush);
BRUSH_ShareUnlockBrush(pDC->eboBackground.pbrush);
return TRUE; return TRUE;
} }

View file

@ -73,7 +73,6 @@ DC_vUpdateFillBrush(PDC pdc)
PDC_ATTR pdcattr = pdc->pdcattr; PDC_ATTR pdcattr = pdc->pdcattr;
PBRUSH pbrFill; PBRUSH pbrFill;
XLATEOBJ *pxlo = NULL; XLATEOBJ *pxlo = NULL;
ULONG iSolidColor;
/* Check if the brush handle has changed */ /* Check if the brush handle has changed */
if (pdcattr->hbrush != pdc->dclevel.pbrFill->BaseObject.hHmgr) if (pdcattr->hbrush != pdc->dclevel.pbrFill->BaseObject.hHmgr)
@ -96,9 +95,6 @@ DC_vUpdateFillBrush(PDC pdc)
{ {
/* Invalid brush handle, restore old one */ /* Invalid brush handle, restore old one */
pdcattr->hbrush = pdc->dclevel.pbrFill->BaseObject.hHmgr; pdcattr->hbrush = pdc->dclevel.pbrFill->BaseObject.hHmgr;
/* ROS HACK, should use surf xlate */
IntUpdateBrushXlate(pdc, &pdc->rosdc.XlateBrush, pdc->dclevel.pbrFill);
} }
} }
@ -108,11 +104,8 @@ DC_vUpdateFillBrush(PDC pdc)
/* Check for DC brush */ /* Check for DC brush */
if (pdcattr->hbrush == StockObjects[DC_BRUSH]) if (pdcattr->hbrush == StockObjects[DC_BRUSH])
{ {
/* Translate the color to the target format */
iSolidColor = XLATEOBJ_iXlate(pxlo, pdcattr->crPenClr);
/* Update the eboFill's solid color */ /* Update the eboFill's solid color */
EBRUSHOBJ_vSetSolidBrushColor(&pdc->eboFill, iSolidColor); EBRUSHOBJ_vSetSolidBrushColor(&pdc->eboFill, pdcattr->crPenClr, pxlo);
} }
/* Clear flags */ /* Clear flags */
@ -126,16 +119,12 @@ DC_vUpdateLineBrush(PDC pdc)
PDC_ATTR pdcattr = pdc->pdcattr; PDC_ATTR pdcattr = pdc->pdcattr;
PBRUSH pbrLine; PBRUSH pbrLine;
XLATEOBJ *pxlo; XLATEOBJ *pxlo;
ULONG iSolidColor;
/* ROS HACK, should use surf xlate */
pxlo = pdc->rosdc.XlatePen;
/* Check if the pen handle has changed */ /* Check if the pen handle has changed */
if (pdcattr->hpen != pdc->dclevel.pbrLine->BaseObject.hHmgr) if (pdcattr->hpen != pdc->dclevel.pbrLine->BaseObject.hHmgr)
{ {
/* Try to lock the new pen */ /* Try to lock the new pen */
pbrLine = BRUSH_ShareLockBrush(pdcattr->hpen); pbrLine = PEN_ShareLockPen(pdcattr->hpen);
if (pbrLine) if (pbrLine)
{ {
/* Unlock old brush, set new brush */ /* Unlock old brush, set new brush */
@ -152,9 +141,6 @@ DC_vUpdateLineBrush(PDC pdc)
{ {
/* Invalid pen handle, restore old one */ /* Invalid pen handle, restore old one */
pdcattr->hpen = pdc->dclevel.pbrLine->BaseObject.hHmgr; pdcattr->hpen = pdc->dclevel.pbrLine->BaseObject.hHmgr;
/* ROS HACK, should use surf xlate */
IntUpdateBrushXlate(pdc, &pdc->rosdc.XlatePen, pdc->dclevel.pbrLine);
} }
} }
@ -164,11 +150,8 @@ DC_vUpdateLineBrush(PDC pdc)
/* Check for DC pen */ /* Check for DC pen */
if (pdcattr->hpen == StockObjects[DC_PEN]) if (pdcattr->hpen == StockObjects[DC_PEN])
{ {
/* Translate the color to the target format */
iSolidColor = XLATEOBJ_iXlate(pxlo, pdcattr->crPenClr);
/* Update the eboLine's solid color */ /* Update the eboLine's solid color */
EBRUSHOBJ_vSetSolidBrushColor(&pdc->eboLine, iSolidColor); EBRUSHOBJ_vSetSolidBrushColor(&pdc->eboLine, pdcattr->crPenClr, pxlo);
} }
/* Clear flags */ /* Clear flags */
@ -180,17 +163,27 @@ FASTCALL
DC_vUpdateTextBrush(PDC pdc) DC_vUpdateTextBrush(PDC pdc)
{ {
PDC_ATTR pdcattr = pdc->pdcattr; PDC_ATTR pdcattr = pdc->pdcattr;
XLATEOBJ *pxlo; XLATEOBJ *pxlo = NULL;
ULONG iSolidColor; SURFACE *psurf;
HPALETTE hpal;
/* ROS HACK, should use surf xlate */ // psurf = pdc->dclevel.pSurface;
pxlo = pdc->rosdc.XlatePen; psurf = SURFACE_LockSurface(pdc->rosdc.hBitmap);
if (psurf)
/* Translate the color to the target format */ {
iSolidColor = XLATEOBJ_iXlate(pxlo, pdcattr->crForegroundClr); hpal = psurf->hDIBPalette;
if (!hpal) hpal = pPrimarySurface->DevInfo.hpalDefault;
pxlo = IntEngCreateXlate(0, PAL_RGB, hpal, NULL);
SURFACE_UnlockSurface(psurf);
}
/* Update the eboText's solid color */ /* Update the eboText's solid color */
EBRUSHOBJ_vSetSolidBrushColor(&pdc->eboText, iSolidColor); EBRUSHOBJ_vSetSolidBrushColor(&pdc->eboText, pdcattr->crForegroundClr, pxlo);
if (pxlo)
{
EngDeleteXlate(pxlo);
}
/* Clear flag */ /* Clear flag */
pdcattr->ulDirty_ &= ~DIRTY_TEXT; pdcattr->ulDirty_ &= ~DIRTY_TEXT;
@ -201,17 +194,27 @@ FASTCALL
DC_vUpdateBackgroundBrush(PDC pdc) DC_vUpdateBackgroundBrush(PDC pdc)
{ {
PDC_ATTR pdcattr = pdc->pdcattr; PDC_ATTR pdcattr = pdc->pdcattr;
XLATEOBJ *pxlo; XLATEOBJ *pxlo = NULL;
ULONG iSolidColor; SURFACE *psurf;
HPALETTE hpal;
/* ROS HACK, should use surf xlate */ // psurf = pdc->dclevel.pSurface;
pxlo = pdc->rosdc.XlatePen; psurf = SURFACE_LockSurface(pdc->rosdc.hBitmap);
if (psurf)
/* Translate the color to the target format */ {
iSolidColor = XLATEOBJ_iXlate(pxlo, pdcattr->crBackgroundClr); hpal = psurf->hDIBPalette;
if (!hpal) hpal = pPrimarySurface->DevInfo.hpalDefault;
pxlo = IntEngCreateXlate(0, PAL_RGB, hpal, NULL);
SURFACE_UnlockSurface(psurf);
}
/* Update the eboBackground's solid color */ /* Update the eboBackground's solid color */
EBRUSHOBJ_vSetSolidBrushColor(&pdc->eboBackground, iSolidColor); EBRUSHOBJ_vSetSolidBrushColor(&pdc->eboBackground, pdcattr->crBackgroundClr, pxlo);
if (pxlo)
{
EngDeleteXlate(pxlo);
}
/* Clear flag */ /* Clear flag */
pdcattr->ulDirty_ &= ~DIRTY_BACKGROUND; pdcattr->ulDirty_ &= ~DIRTY_BACKGROUND;
@ -270,33 +273,15 @@ IntGdiSelectBrush(
{ {
PDC_ATTR pdcattr; PDC_ATTR pdcattr;
HBRUSH hOrgBrush; HBRUSH hOrgBrush;
PBRUSH pbrush;
BOOLEAN bSuccess;
if (pDC == NULL || hBrush == NULL) return NULL; if (pDC == NULL || hBrush == NULL) return NULL;
pdcattr = pDC->pdcattr; pdcattr = pDC->pdcattr;
pbrush = BRUSH_LockBrush(hBrush);
if (pbrush == NULL)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return NULL;
}
hOrgBrush = pdcattr->hbrush; hOrgBrush = pdcattr->hbrush;
pdcattr->hbrush = hBrush; pdcattr->hbrush = hBrush;
DC_vSelectFillBrush(pDC, pbrush); DC_vUpdateFillBrush(pDC);
bSuccess = IntUpdateBrushXlate(pDC, &pDC->rosdc.XlateBrush, pbrush);
BRUSH_UnlockBrush(pbrush);
if(!bSuccess)
{
return NULL;
}
pdcattr->ulDirty_ &= ~DC_BRUSH_DIRTY;
return hOrgBrush; return hOrgBrush;
} }
@ -309,33 +294,15 @@ IntGdiSelectPen(
{ {
PDC_ATTR pdcattr; PDC_ATTR pdcattr;
HPEN hOrgPen = NULL; HPEN hOrgPen = NULL;
PBRUSH pbrushPen;
BOOLEAN bSuccess;
if (pDC == NULL || hPen == NULL) return NULL; if (pDC == NULL || hPen == NULL) return NULL;
pdcattr = pDC->pdcattr; pdcattr = pDC->pdcattr;
pbrushPen = PEN_LockPen(hPen);
if (pbrushPen == NULL)
{
return NULL;
}
hOrgPen = pdcattr->hpen; hOrgPen = pdcattr->hpen;
pdcattr->hpen = hPen; pdcattr->hpen = hPen;
DC_vSelectLineBrush(pDC, pbrushPen); DC_vUpdateLineBrush(pDC);
bSuccess = IntUpdateBrushXlate(pDC, &pDC->rosdc.XlatePen, pbrushPen);
PEN_UnlockPen(pbrushPen);
if (!bSuccess)
{
SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
return NULL;
}
pdcattr->ulDirty_ &= ~DC_PEN_DIRTY;
return hOrgPen; return hOrgPen;
} }
@ -361,7 +328,10 @@ NtGdiSelectBrush(
return NULL; return NULL;
} }
hOrgBrush = IntGdiSelectBrush(pDC,hBrush); // hOrgBrush = IntGdiSelectBrush(pDC,hBrush);
hOrgBrush = pDC->pdcattr->hbrush;
pDC->pdcattr->hbrush = hBrush;
DC_vUpdateFillBrush(pDC);
DC_UnlockDc(pDC); DC_UnlockDc(pDC);
@ -388,7 +358,10 @@ NtGdiSelectPen(
return NULL; return NULL;
} }
hOrgPen = IntGdiSelectPen(pDC, hPen); // hOrgPen = IntGdiSelectPen(pDC, hPen);
hOrgPen = pDC->pdcattr->hpen;
pDC->pdcattr->hpen = hPen;
DC_vUpdateLineBrush(pDC);
DC_UnlockDc(pDC); DC_UnlockDc(pDC);

View file

@ -75,25 +75,26 @@ FASTCALL
IntGdiSetTextColor(HDC hDC, IntGdiSetTextColor(HDC hDC,
COLORREF color) COLORREF color)
{ {
COLORREF oldColor; COLORREF crOldColor;
PDC dc = DC_LockDc(hDC); PDC pdc;
PDC_ATTR pdcattr; PDC_ATTR pdcattr;
HBRUSH hBrush;
if (!dc) pdc = DC_LockDc(hDC);
if (!pdc)
{ {
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return CLR_INVALID; return CLR_INVALID;
} }
pdcattr = dc->pdcattr; pdcattr = pdc->pdcattr;
oldColor = pdcattr->crForegroundClr; // What about ulForegroundClr, like in gdi32?
crOldColor = pdcattr->crForegroundClr;
pdcattr->crForegroundClr = color; pdcattr->crForegroundClr = color;
hBrush = pdcattr->hbrush; DC_vUpdateTextBrush(pdc);
pdcattr->ulDirty_ &= ~(DIRTY_TEXT|DIRTY_LINE|DIRTY_FILL);
DC_UnlockDc(dc); DC_UnlockDc(pdc);
NtGdiSelectBrush(hDC, hBrush);
return oldColor; return crOldColor;
} }
VOID VOID

View file

@ -1192,7 +1192,6 @@ IntFillRect( DC *dc,
DWORD ROP = PATCOPY; DWORD ROP = PATCOPY;
RECTL DestRect; RECTL DestRect;
SURFACE *psurf; SURFACE *psurf;
EBRUSHOBJ eboFill;
POINTL BrushOrigin; POINTL BrushOrigin;
BOOL Ret = TRUE; BOOL Ret = TRUE;
PDC_ATTR pdcattr; PDC_ATTR pdcattr;
@ -1236,11 +1235,6 @@ IntFillRect( DC *dc,
else else
ROP = PATCOPY; ROP = PATCOPY;
if (Pen)
EBRUSHOBJ_vInit(&eboFill, pbrush, dc->rosdc.XlatePen);
else
EBRUSHOBJ_vInit(&eboFill, pbrush, dc->rosdc.XlateBrush);
Ret = IntEngBitBlt( Ret = IntEngBitBlt(
&psurf->SurfObj, &psurf->SurfObj,
NULL, NULL,
@ -1250,7 +1244,7 @@ IntFillRect( DC *dc,
&DestRect, &DestRect,
NULL, NULL,
NULL, NULL,
&eboFill.BrushObject, // use pDC->eboFill Pen ? &dc->eboLine.BrushObject : &dc->eboFill.BrushObject,
&BrushOrigin, &BrushOrigin,
ROP3_TO_ROP4(ROP)); ROP3_TO_ROP4(ROP));
} }

View file

@ -36,8 +36,7 @@ IntGdiPolygon(PDC dc,
int Count) int Count)
{ {
SURFACE *psurf; SURFACE *psurf;
PBRUSH pbrushLine, pbrushFill; PBRUSH pbrLine, pbrFill;
EBRUSHOBJ eboLine, eboFill;
BOOL ret = FALSE; // default to failure BOOL ret = FALSE; // default to failure
RECTL DestRect; RECTL DestRect;
int CurrentPoint; int CurrentPoint;
@ -95,32 +94,32 @@ IntGdiPolygon(PDC dc,
IntGdiSelectPen(dc,pdcattr->hpen); IntGdiSelectPen(dc,pdcattr->hpen);
/* Special locking order to avoid lock-ups */ /* Special locking order to avoid lock-ups */
pbrushFill = BRUSH_LockBrush(pdcattr->hbrush); pbrFill = dc->dclevel.pbrFill;
pbrushLine = PEN_LockPen(pdcattr->hpen); pbrLine = dc->dclevel.pbrLine;
psurf = SURFACE_LockSurface(dc->rosdc.hBitmap); psurf = SURFACE_LockSurface(dc->rosdc.hBitmap);
/* FIXME - psurf can be NULL!!!! don't assert but handle this case gracefully! */ /* FIXME - psurf can be NULL!!!! don't assert but handle this case gracefully! */
ASSERT(psurf); ASSERT(psurf);
/* Now fill the polygon with the current brush. */ /* Now fill the polygon with the current fill brush. */
if (pbrushFill && !(pbrushFill->flAttrs & GDIBRUSH_IS_NULL)) if (!(pbrFill->flAttrs & GDIBRUSH_IS_NULL))
{ {
BrushOrigin = *((PPOINTL)&pbrushFill->ptOrigin); BrushOrigin = *((PPOINTL)&pbrFill->ptOrigin);
BrushOrigin.x += dc->ptlDCOrig.x; BrushOrigin.x += dc->ptlDCOrig.x;
BrushOrigin.y += dc->ptlDCOrig.y; BrushOrigin.y += dc->ptlDCOrig.y;
EBRUSHOBJ_vInit(&eboFill, pbrushFill, dc->rosdc.XlateBrush); ret = IntFillPolygon (dc,
ret = IntFillPolygon (dc, psurf, &eboFill.BrushObject, Points, Count, psurf,
DestRect, &BrushOrigin); &dc->eboFill.BrushObject,
Points,
Count,
DestRect,
&BrushOrigin);
} }
if (pbrushFill)
BRUSH_UnlockBrush(pbrushFill);
// Draw the Polygon Edges with the current pen ( if not a NULL pen ) // Draw the Polygon Edges with the current pen ( if not a NULL pen )
if (pbrushLine && !(pbrushLine->flAttrs & GDIBRUSH_IS_NULL)) if (!(pbrLine->flAttrs & GDIBRUSH_IS_NULL))
{ {
int i; int i;
EBRUSHOBJ_vInit(&eboLine, pbrushLine, dc->rosdc.XlatePen);
for (i = 0; i < Count-1; i++) for (i = 0; i < Count-1; i++)
{ {
@ -130,7 +129,7 @@ IntGdiPolygon(PDC dc,
ret = IntEngLineTo(&psurf->SurfObj, ret = IntEngLineTo(&psurf->SurfObj,
dc->rosdc.CombinedClip, dc->rosdc.CombinedClip,
&eboLine.BrushObject, &dc->eboLine.BrushObject,
Points[i].x, /* From */ Points[i].x, /* From */
Points[i].y, Points[i].y,
Points[i+1].x, /* To */ Points[i+1].x, /* To */
@ -144,7 +143,7 @@ IntGdiPolygon(PDC dc,
{ {
ret = IntEngLineTo(&psurf->SurfObj, ret = IntEngLineTo(&psurf->SurfObj,
dc->rosdc.CombinedClip, dc->rosdc.CombinedClip,
&eboLine.BrushObject, &dc->eboLine.BrushObject,
Points[Count-1].x, /* From */ Points[Count-1].x, /* From */
Points[Count-1].y, Points[Count-1].y,
Points[0].x, /* To */ Points[0].x, /* To */
@ -153,8 +152,6 @@ IntGdiPolygon(PDC dc,
ROP2_TO_MIX(pdcattr->jROP2)); /* MIX */ ROP2_TO_MIX(pdcattr->jROP2)); /* MIX */
} }
} }
if (pbrushLine)
PEN_UnlockPen(pbrushLine);
} }
SURFACE_UnlockSurface(psurf); SURFACE_UnlockSurface(psurf);
@ -522,8 +519,7 @@ IntRectangle(PDC dc,
int BottomRect) int BottomRect)
{ {
SURFACE *psurf = NULL; SURFACE *psurf = NULL;
PBRUSH pbrushLine = NULL, pbrushFill = NULL; PBRUSH pbrLine, pbrFill;
EBRUSHOBJ eboLine, eboFill;
BOOL ret = FALSE; // default to failure BOOL ret = FALSE; // default to failure
RECTL DestRect; RECTL DestRect;
MIX Mix; MIX Mix;
@ -578,10 +574,9 @@ IntRectangle(PDC dc,
if (pdcattr->ulDirty_ & DC_PEN_DIRTY) if (pdcattr->ulDirty_ & DC_PEN_DIRTY)
IntGdiSelectPen(dc,pdcattr->hpen); IntGdiSelectPen(dc,pdcattr->hpen);
/* Special locking order to avoid lock-ups! */ pbrFill = dc->dclevel.pbrFill;
pbrushFill = BRUSH_LockBrush(pdcattr->hbrush); pbrLine = dc->dclevel.pbrLine;
pbrushLine = PEN_LockPen(pdcattr->hpen); if (!pbrLine)
if (!pbrushLine)
{ {
ret = FALSE; ret = FALSE;
goto cleanup; goto cleanup;
@ -593,14 +588,13 @@ IntRectangle(PDC dc,
goto cleanup; goto cleanup;
} }
if ( pbrushFill ) if (pbrFill)
{ {
if (!(pbrushFill->flAttrs & GDIBRUSH_IS_NULL)) if (!(pbrFill->flAttrs & GDIBRUSH_IS_NULL))
{ {
BrushOrigin = *((PPOINTL)&pbrushFill->ptOrigin); BrushOrigin = *((PPOINTL)&pbrFill->ptOrigin);
BrushOrigin.x += dc->ptlDCOrig.x; BrushOrigin.x += dc->ptlDCOrig.x;
BrushOrigin.y += dc->ptlDCOrig.y; BrushOrigin.y += dc->ptlDCOrig.y;
EBRUSHOBJ_vInit(&eboFill, pbrushFill, dc->rosdc.XlateBrush);
ret = IntEngBitBlt(&psurf->SurfObj, ret = IntEngBitBlt(&psurf->SurfObj,
NULL, NULL,
NULL, NULL,
@ -609,57 +603,49 @@ IntRectangle(PDC dc,
&DestRect, &DestRect,
NULL, NULL,
NULL, NULL,
&eboFill.BrushObject, &dc->eboFill.BrushObject,
&BrushOrigin, &BrushOrigin,
ROP3_TO_ROP4(PATCOPY)); ROP3_TO_ROP4(PATCOPY));
} }
} }
EBRUSHOBJ_vInit(&eboLine, pbrushLine, dc->rosdc.XlatePen);
// Draw the rectangle with the current pen // Draw the rectangle with the current pen
ret = TRUE; // change default to success ret = TRUE; // change default to success
if (!(pbrushLine->flAttrs & GDIBRUSH_IS_NULL)) if (!(pbrLine->flAttrs & GDIBRUSH_IS_NULL))
{ {
Mix = ROP2_TO_MIX(pdcattr->jROP2); Mix = ROP2_TO_MIX(pdcattr->jROP2);
ret = ret && IntEngLineTo(&psurf->SurfObj, ret = ret && IntEngLineTo(&psurf->SurfObj,
dc->rosdc.CombinedClip, dc->rosdc.CombinedClip,
&eboLine.BrushObject, &dc->eboLine.BrushObject,
DestRect.left, DestRect.top, DestRect.right, DestRect.top, DestRect.left, DestRect.top, DestRect.right, DestRect.top,
&DestRect, // Bounding rectangle &DestRect, // Bounding rectangle
Mix); Mix);
ret = ret && IntEngLineTo(&psurf->SurfObj, ret = ret && IntEngLineTo(&psurf->SurfObj,
dc->rosdc.CombinedClip, dc->rosdc.CombinedClip,
&eboLine.BrushObject, &dc->eboLine.BrushObject,
DestRect.right, DestRect.top, DestRect.right, DestRect.bottom, DestRect.right, DestRect.top, DestRect.right, DestRect.bottom,
&DestRect, // Bounding rectangle &DestRect, // Bounding rectangle
Mix); Mix);
ret = ret && IntEngLineTo(&psurf->SurfObj, ret = ret && IntEngLineTo(&psurf->SurfObj,
dc->rosdc.CombinedClip, dc->rosdc.CombinedClip,
&eboLine.BrushObject, &dc->eboLine.BrushObject,
DestRect.right, DestRect.bottom, DestRect.left, DestRect.bottom, DestRect.right, DestRect.bottom, DestRect.left, DestRect.bottom,
&DestRect, // Bounding rectangle &DestRect, // Bounding rectangle
Mix); Mix);
ret = ret && IntEngLineTo(&psurf->SurfObj, ret = ret && IntEngLineTo(&psurf->SurfObj,
dc->rosdc.CombinedClip, dc->rosdc.CombinedClip,
&eboLine.BrushObject, &dc->eboLine.BrushObject,
DestRect.left, DestRect.bottom, DestRect.left, DestRect.top, DestRect.left, DestRect.bottom, DestRect.left, DestRect.top,
&DestRect, // Bounding rectangle &DestRect, // Bounding rectangle
Mix); Mix);
} }
cleanup: cleanup:
if (pbrushFill)
BRUSH_UnlockBrush(pbrushFill);
if (pbrushLine)
PEN_UnlockPen(pbrushLine);
if (psurf) if (psurf)
SURFACE_UnlockSurface(psurf); SURFACE_UnlockSurface(psurf);
@ -1086,12 +1072,10 @@ NtGdiExtFloodFill(
PDC dc; PDC dc;
PDC_ATTR pdcattr; PDC_ATTR pdcattr;
SURFACE *psurf = NULL; SURFACE *psurf = NULL;
PBRUSH pbrushFill = NULL; PBRUSH pbrFill = NULL;
EBRUSHOBJ eboFill;
BOOL Ret = FALSE; BOOL Ret = FALSE;
RECTL DestRect; RECTL DestRect;
POINTL Pt; POINTL Pt;
POINTL BrushOrigin;
DPRINT1("FIXME: NtGdiExtFloodFill is UNIMPLEMENTED\n"); DPRINT1("FIXME: NtGdiExtFloodFill is UNIMPLEMENTED\n");
@ -1110,11 +1094,11 @@ NtGdiExtFloodFill(
pdcattr = dc->pdcattr; pdcattr = dc->pdcattr;
if (pdcattr->ulDirty_ & DC_PEN_DIRTY) if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
IntGdiSelectPen(dc,pdcattr->hpen); DC_vUpdateFillBrush(dc);
if (pdcattr->ulDirty_ & DC_BRUSH_DIRTY) if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
IntGdiSelectBrush(dc,pdcattr->hbrush); DC_vUpdateLineBrush(dc);
Pt.x = XStart; Pt.x = XStart;
Pt.y = YStart; Pt.y = YStart;
@ -1126,8 +1110,8 @@ NtGdiExtFloodFill(
else else
goto cleanup; goto cleanup;
pbrushFill = BRUSH_LockBrush(pdcattr->hbrush); pbrFill = dc->dclevel.pbrFill;
if (!pbrushFill) if (!pbrFill)
{ {
Ret = FALSE; Ret = FALSE;
goto cleanup; goto cleanup;
@ -1139,31 +1123,7 @@ NtGdiExtFloodFill(
goto cleanup; goto cleanup;
} }
if ( pbrushFill && (FillType == FLOODFILLBORDER))
{
if (!(pbrushFill->flAttrs & GDIBRUSH_IS_NULL))
{
pbrushFill->BrushAttr.lbColor = Color;
BrushOrigin = *((PPOINTL)&pbrushFill->ptOrigin);
BrushOrigin.x += dc->ptlDCOrig.x;
BrushOrigin.y += dc->ptlDCOrig.y;
EBRUSHOBJ_vInit(&eboFill, pbrushFill, dc->rosdc.XlateBrush);
Ret = IntEngBitBlt(&psurf->SurfObj, NULL, NULL,
dc->rosdc.CombinedClip, NULL,
&DestRect, NULL, NULL,
&eboFill.BrushObject,
&BrushOrigin,
ROP3_TO_ROP4(PATCOPY));
}
}
else
{
}
cleanup: cleanup:
if (pbrushFill)
BRUSH_UnlockBrush(pbrushFill);
if (psurf) if (psurf)
SURFACE_UnlockSurface(psurf); SURFACE_UnlockSurface(psurf);

View file

@ -3128,12 +3128,6 @@ GreExtTextOutW(
FT_Bool use_kerning; FT_Bool use_kerning;
RECTL DestRect, MaskRect; RECTL DestRect, MaskRect;
POINTL SourcePoint, BrushOrigin; POINTL SourcePoint, BrushOrigin;
HBRUSH hbrushText = NULL;
PBRUSH pbrushText = NULL;
EBRUSHOBJ eboText;
HBRUSH hbrushBackGnd = NULL;
PBRUSH pbrushBackGnd = NULL;
EBRUSHOBJ eboBackGnd;
HBITMAP HSourceGlyph; HBITMAP HSourceGlyph;
SURFOBJ *SourceGlyphSurf; SURFOBJ *SourceGlyphSurf;
SIZEL bitSize; SIZEL bitSize;
@ -3142,9 +3136,7 @@ GreExtTextOutW(
FONTOBJ *FontObj; FONTOBJ *FontObj;
PFONTGDI FontGDI; PFONTGDI FontGDI;
PTEXTOBJ TextObj = NULL; PTEXTOBJ TextObj = NULL;
PPALGDI PalDestGDI;
XLATEOBJ *XlateObj=NULL, *XlateObj2=NULL; XLATEOBJ *XlateObj=NULL, *XlateObj2=NULL;
ULONG Mode;
FT_Render_Mode RenderMode; FT_Render_Mode RenderMode;
BOOLEAN Render; BOOLEAN Render;
POINT Start; POINT Start;
@ -3169,6 +3161,15 @@ GreExtTextOutW(
pdcattr = dc->pdcattr; pdcattr = dc->pdcattr;
if (pdcattr->ulDirty_ & DIRTY_TEXT)
DC_vUpdateTextBrush(dc);
if ((fuOptions & ETO_OPAQUE) || pdcattr->jBkMode == OPAQUE)
{
if (pdcattr->ulDirty_ & DIRTY_BACKGROUND)
DC_vUpdateBackgroundBrush(dc);
}
/* Check if String is valid */ /* Check if String is valid */
if ((Count > 0xFFFF) || (Count > 0 && String == NULL)) if ((Count > 0xFFFF) || (Count > 0 && String == NULL))
{ {
@ -3202,7 +3203,6 @@ GreExtTextOutW(
goto fail; goto fail;
} }
SurfObj = &psurf->SurfObj; SurfObj = &psurf->SurfObj;
ASSERT(SurfObj);
Start.x = XStart; Start.x = XStart;
Start.y = YStart; Start.y = YStart;
@ -3214,45 +3214,12 @@ GreExtTextOutW(
/* Create the brushes */ /* Create the brushes */
hDestPalette = psurf->hDIBPalette; hDestPalette = psurf->hDIBPalette;
if (!hDestPalette) hDestPalette = pPrimarySurface->DevInfo.hpalDefault; if (!hDestPalette) hDestPalette = pPrimarySurface->DevInfo.hpalDefault;
PalDestGDI = PALETTE_LockPalette(hDestPalette); XlateObj = (XLATEOBJ*)IntEngCreateXlate(0, PAL_RGB, hDestPalette, NULL);
if ( !PalDestGDI )
Mode = PAL_RGB;
else
{
Mode = PalDestGDI->Mode;
PALETTE_UnlockPalette(PalDestGDI);
}
XlateObj = (XLATEOBJ*)IntEngCreateXlate(Mode, PAL_RGB, hDestPalette, NULL);
if ( !XlateObj ) if ( !XlateObj )
{ {
goto fail; goto fail;
} }
hbrushText = NtGdiCreateSolidBrush(XLATEOBJ_iXlate(XlateObj, pdcattr->crForegroundClr), 0); XlateObj2 = (XLATEOBJ*)IntEngCreateXlate(PAL_RGB, 0, NULL, hDestPalette);
if ( !hbrushText )
{
goto fail;
}
pbrushText = BRUSH_LockBrush(hbrushText);
if ( !pbrushText )
{
goto fail;
}
EBRUSHOBJ_vInit(&eboText, pbrushText, NULL);
if ((fuOptions & ETO_OPAQUE) || pdcattr->jBkMode == OPAQUE)
{
hbrushBackGnd = NtGdiCreateSolidBrush(XLATEOBJ_iXlate(XlateObj, pdcattr->crBackgroundClr), 0);
if ( !hbrushBackGnd )
{
goto fail;
}
pbrushBackGnd = BRUSH_LockBrush(hbrushBackGnd);
if ( !pbrushBackGnd )
{
goto fail;
}
EBRUSHOBJ_vInit(&eboBackGnd, pbrushBackGnd, NULL);
}
XlateObj2 = (XLATEOBJ*)IntEngCreateXlate(PAL_RGB, Mode, NULL, hDestPalette);
if ( !XlateObj2 ) if ( !XlateObj2 )
{ {
goto fail; goto fail;
@ -3281,7 +3248,7 @@ GreExtTextOutW(
&DestRect, &DestRect,
&SourcePoint, &SourcePoint,
&SourcePoint, &SourcePoint,
&eboBackGnd.BrushObject, &dc->eboBackground.BrushObject,
&BrushOrigin, &BrushOrigin,
ROP3_TO_ROP4(PATCOPY)); ROP3_TO_ROP4(PATCOPY));
fuOptions &= ~ETO_OPAQUE; fuOptions &= ~ETO_OPAQUE;
@ -3527,7 +3494,7 @@ GreExtTextOutW(
&DestRect, &DestRect,
&SourcePoint, &SourcePoint,
&SourcePoint, &SourcePoint,
&eboBackGnd.BrushObject, &dc->eboBackground.BrushObject,
&BrushOrigin, &BrushOrigin,
ROP3_TO_ROP4(PATCOPY)); ROP3_TO_ROP4(PATCOPY));
BackgroundLeft = DestRect.right; BackgroundLeft = DestRect.right;
@ -3599,7 +3566,7 @@ GreExtTextOutW(
&DestRect, &DestRect,
&SourcePoint, &SourcePoint,
(PPOINTL)&MaskRect, (PPOINTL)&MaskRect,
&eboText.BrushObject, &dc->eboText.BrushObject,
&BrushOrigin); &BrushOrigin);
EngUnlockSurface(SourceGlyphSurf); EngUnlockSurface(SourceGlyphSurf);
@ -3638,13 +3605,6 @@ GreExtTextOutW(
SURFACE_UnlockSurface(psurf); SURFACE_UnlockSurface(psurf);
if (TextObj != NULL) if (TextObj != NULL)
TEXTOBJ_UnlockText(TextObj); TEXTOBJ_UnlockText(TextObj);
if (hbrushBackGnd != NULL)
{
BRUSH_UnlockBrush(pbrushBackGnd);
GreDeleteObject(hbrushBackGnd);
}
BRUSH_UnlockBrush(pbrushText);
GreDeleteObject(hbrushText);
good: good:
DC_UnlockDc( dc ); DC_UnlockDc( dc );
@ -3659,16 +3619,6 @@ fail:
TEXTOBJ_UnlockText(TextObj); TEXTOBJ_UnlockText(TextObj);
if (psurf != NULL) if (psurf != NULL)
SURFACE_UnlockSurface(psurf); SURFACE_UnlockSurface(psurf);
if (hbrushBackGnd != NULL)
{
BRUSH_UnlockBrush(pbrushBackGnd);
GreDeleteObject(hbrushBackGnd);
}
if (hbrushText != NULL)
{
BRUSH_UnlockBrush(pbrushText);
GreDeleteObject(hbrushText);
}
DC_UnlockDc(dc); DC_UnlockDc(dc);
return FALSE; return FALSE;

View file

@ -89,13 +89,11 @@ IntGdiLineTo(DC *dc,
{ {
SURFACE *psurf; SURFACE *psurf;
BOOL Ret = TRUE; BOOL Ret = TRUE;
PBRUSH pbrushLine; PBRUSH pbrLine;
EBRUSHOBJ eboLine;
RECTL Bounds; RECTL Bounds;
POINT Points[2]; POINT Points[2];
PDC_ATTR pdcattr = dc->pdcattr; PDC_ATTR pdcattr = dc->pdcattr;
if (PATH_IsPathOpen(dc->dclevel)) if (PATH_IsPathOpen(dc->dclevel))
{ {
Ret = PATH_LineTo(dc, XEnd, YEnd); Ret = PATH_LineTo(dc, XEnd, YEnd);
@ -112,11 +110,8 @@ IntGdiLineTo(DC *dc,
} }
else else
{ {
if (pdcattr->ulDirty_ & DC_BRUSH_DIRTY) if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
IntGdiSelectBrush(dc,pdcattr->hbrush); DC_vUpdateLineBrush(dc);
if (pdcattr->ulDirty_ & DC_PEN_DIRTY)
IntGdiSelectPen(dc,pdcattr->hpen);
psurf = SURFACE_LockSurface( dc->rosdc.hBitmap ); psurf = SURFACE_LockSurface( dc->rosdc.hBitmap );
if (NULL == psurf) if (NULL == psurf)
@ -144,20 +139,14 @@ IntGdiLineTo(DC *dc,
Bounds.bottom = max(Points[0].y, Points[1].y); Bounds.bottom = max(Points[0].y, Points[1].y);
/* get BRUSH from current pen. */ /* get BRUSH from current pen. */
pbrushLine = PEN_LockPen( pdcattr->hpen ); pbrLine = dc->dclevel.pbrLine;
if (!pbrushLine) ASSERT(pbrLine);
{
/* default to BLACK_PEN */
pbrushLine = PEN_LockPen(NtGdiGetStockObject(BLACK_PEN));
ASSERT(pbrushLine);
}
if (!(pbrushLine->flAttrs & GDIBRUSH_IS_NULL)) if (!(pbrLine->flAttrs & GDIBRUSH_IS_NULL))
{ {
EBRUSHOBJ_vInit(&eboLine, pbrushLine, dc->rosdc.XlatePen);
Ret = IntEngLineTo(&psurf->SurfObj, Ret = IntEngLineTo(&psurf->SurfObj,
dc->rosdc.CombinedClip, dc->rosdc.CombinedClip,
&eboLine.BrushObject, &dc->eboLine.BrushObject,
Points[0].x, Points[0].y, Points[0].x, Points[0].y,
Points[1].x, Points[1].y, Points[1].x, Points[1].y,
&Bounds, &Bounds,
@ -165,7 +154,6 @@ IntGdiLineTo(DC *dc,
} }
SURFACE_UnlockSurface(psurf); SURFACE_UnlockSurface(psurf);
PEN_UnlockPen( pbrushLine );
} }
if (Ret) if (Ret)
@ -251,8 +239,7 @@ IntGdiPolyline(DC *dc,
int Count) int Count)
{ {
SURFACE *psurf; SURFACE *psurf;
BRUSH *pbrushLine; BRUSH *pbrLine;
EBRUSHOBJ eboLine;
LPPOINT Points; LPPOINT Points;
BOOL Ret = TRUE; BOOL Ret = TRUE;
LONG i; LONG i;
@ -261,18 +248,17 @@ IntGdiPolyline(DC *dc,
if (PATH_IsPathOpen(dc->dclevel)) if (PATH_IsPathOpen(dc->dclevel))
return PATH_Polyline(dc, pt, Count); return PATH_Polyline(dc, pt, Count);
if (pdcattr->ulDirty_ & DC_BRUSH_DIRTY) if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
IntGdiSelectBrush(dc,pdcattr->hbrush); DC_vUpdateFillBrush(dc);
if (pdcattr->ulDirty_ & DC_PEN_DIRTY) if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
IntGdiSelectPen(dc,pdcattr->hpen); DC_vUpdateLineBrush(dc);
/* Get BRUSHOBJ from current pen. */ /* Get BRUSHOBJ from current pen. */
pbrushLine = PEN_LockPen(pdcattr->hpen); pbrLine = dc->dclevel.pbrLine;
/* FIXME - pbrushLine can be NULL! Don't assert here! */ ASSERT(pbrLine);
ASSERT(pbrushLine);
if (!(pbrushLine->flAttrs & GDIBRUSH_IS_NULL)) if (!(pbrLine->flAttrs & GDIBRUSH_IS_NULL))
{ {
Points = EngAllocMem(0, Count * sizeof(POINT), TAG_COORD); Points = EngAllocMem(0, Count * sizeof(POINT), TAG_COORD);
if (Points != NULL) if (Points != NULL)
@ -292,10 +278,9 @@ IntGdiPolyline(DC *dc,
Points[i].y += dc->ptlDCOrig.y; Points[i].y += dc->ptlDCOrig.y;
} }
EBRUSHOBJ_vInit(&eboLine, pbrushLine, dc->rosdc.XlatePen);
Ret = IntEngPolyline(&psurf->SurfObj, Ret = IntEngPolyline(&psurf->SurfObj,
dc->rosdc.CombinedClip, dc->rosdc.CombinedClip,
&eboLine.BrushObject, &dc->eboLine.BrushObject,
Points, Points,
Count, Count,
ROP2_TO_MIX(pdcattr->jROP2)); ROP2_TO_MIX(pdcattr->jROP2));
@ -309,8 +294,6 @@ IntGdiPolyline(DC *dc,
} }
} }
PEN_UnlockPen(pbrushLine);
return Ret; return Ret;
} }

View file

@ -2903,8 +2903,6 @@ IntGdiPaintRgn(
PROSRGNDATA visrgn; PROSRGNDATA visrgn;
CLIPOBJ* ClipRegion; CLIPOBJ* ClipRegion;
BOOL bRet = FALSE; BOOL bRet = FALSE;
PBRUSH pbrush;
EBRUSHOBJ eboFill;
POINTL BrushOrigin; POINTL BrushOrigin;
SURFACE *psurf; SURFACE *psurf;
PDC_ATTR pdcattr; PDC_ATTR pdcattr;
@ -2912,6 +2910,8 @@ IntGdiPaintRgn(
if (!dc) return FALSE; if (!dc) return FALSE;
pdcattr = dc->pdcattr; pdcattr = dc->pdcattr;
ASSERT(!(pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY)));
if (!(tmpVisRgn = NtGdiCreateRectRgn(0, 0, 0, 0))) return FALSE; if (!(tmpVisRgn = NtGdiCreateRectRgn(0, 0, 0, 0))) return FALSE;
// Transform region into device co-ords // Transform region into device co-ords
@ -2935,9 +2935,6 @@ IntGdiPaintRgn(
visrgn->Buffer, visrgn->Buffer,
&visrgn->rdh.rcBound ); &visrgn->rdh.rcBound );
ASSERT(ClipRegion); ASSERT(ClipRegion);
pbrush = BRUSH_LockBrush(pdcattr->hbrush);
ASSERT(pbrush);
EBRUSHOBJ_vInit(&eboFill, pbrush, dc->rosdc.XlateBrush);
BrushOrigin.x = pdcattr->ptlBrushOrigin.x; BrushOrigin.x = pdcattr->ptlBrushOrigin.x;
BrushOrigin.y = pdcattr->ptlBrushOrigin.y; BrushOrigin.y = pdcattr->ptlBrushOrigin.y;
@ -2946,12 +2943,11 @@ IntGdiPaintRgn(
bRet = IntEngPaint(&psurf->SurfObj, bRet = IntEngPaint(&psurf->SurfObj,
ClipRegion, ClipRegion,
&eboFill.BrushObject, &dc->eboFill.BrushObject,
&BrushOrigin, &BrushOrigin,
0xFFFF);//FIXME:don't know what to put here 0xFFFF);//FIXME:don't know what to put here
SURFACE_UnlockSurface(psurf); SURFACE_UnlockSurface(psurf);
BRUSH_UnlockBrush(pbrush);
REGION_UnlockRgn(visrgn); REGION_UnlockRgn(visrgn);
GreDeleteObject(tmpVisRgn); GreDeleteObject(tmpVisRgn);