IntGdiPolyPatBlt: Don't unnecessarily update the dc's brush, improve and simplyfy code,

svn path=/trunk/; revision=41818
This commit is contained in:
Timo Kreuzer 2009-07-08 21:05:37 +00:00
parent 915bec118b
commit 9a36897e48

View file

@ -928,31 +928,34 @@ NtGdiStretchBlt(
BOOL FASTCALL BOOL FASTCALL
IntPatBlt( IntPatBlt(
PDC dc, PDC pdc,
INT XLeft, INT XLeft,
INT YLeft, INT YLeft,
INT Width, INT Width,
INT Height, INT Height,
DWORD ROP, DWORD dwRop,
PBRUSH BrushObj) PBRUSH pbrush)
{ {
RECTL DestRect; RECTL DestRect;
SURFACE *psurf; SURFACE *psurf;
EBRUSHOBJ eboFill; EBRUSHOBJ eboFill;
POINTL BrushOrigin; POINTL BrushOrigin;
BOOL ret = TRUE; BOOL ret;
ASSERT(BrushObj); ASSERT(pbrush);
psurf = dc->dclevel.pSurface; psurf = pdc->dclevel.pSurface;
if (psurf == NULL) if (psurf == NULL)
{ {
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
if (!(BrushObj->flAttrs & GDIBRUSH_IS_NULL)) if (pbrush->flAttrs & GDIBRUSH_IS_NULL)
{ {
return TRUE;
}
if (Width > 0) if (Width > 0)
{ {
DestRect.left = XLeft; DestRect.left = XLeft;
@ -975,31 +978,30 @@ IntPatBlt(
DestRect.bottom = YLeft + 1; DestRect.bottom = YLeft + 1;
} }
IntLPtoDP(dc, (LPPOINT)&DestRect, 2); IntLPtoDP(pdc, (LPPOINT)&DestRect, 2);
DestRect.left += dc->ptlDCOrig.x; DestRect.left += pdc->ptlDCOrig.x;
DestRect.top += dc->ptlDCOrig.y; DestRect.top += pdc->ptlDCOrig.y;
DestRect.right += dc->ptlDCOrig.x; DestRect.right += pdc->ptlDCOrig.x;
DestRect.bottom += dc->ptlDCOrig.y; DestRect.bottom += pdc->ptlDCOrig.y;
BrushOrigin.x = BrushObj->ptOrigin.x + dc->ptlDCOrig.x; BrushOrigin.x = pbrush->ptOrigin.x + pdc->ptlDCOrig.x;
BrushOrigin.y = BrushObj->ptOrigin.y + dc->ptlDCOrig.y; BrushOrigin.y = pbrush->ptOrigin.y + pdc->ptlDCOrig.y;
EBRUSHOBJ_vInit(&eboFill, BrushObj, dc->rosdc.XlateBrush); EBRUSHOBJ_vInit(&eboFill, pbrush, pdc->rosdc.XlateBrush);
ret = IntEngBitBlt( ret = IntEngBitBlt(
&psurf->SurfObj, &psurf->SurfObj,
NULL, NULL,
NULL, NULL,
dc->rosdc.CombinedClip, pdc->rosdc.CombinedClip,
NULL, NULL,
&DestRect, &DestRect,
NULL, NULL,
NULL, NULL,
&eboFill.BrushObject, // use pDC->eboFill &eboFill.BrushObject, // use pDC->eboFill
&BrushOrigin, &BrushOrigin,
ROP3_TO_ROP4(ROP)); ROP3_TO_ROP4(dwRop));
}
return ret; return ret;
} }
@ -1009,52 +1011,46 @@ IntGdiPolyPatBlt(
HDC hDC, HDC hDC,
DWORD dwRop, DWORD dwRop,
PPATRECT pRects, PPATRECT pRects,
int cRects, INT cRects,
ULONG Reserved) ULONG Reserved)
{ {
int i; INT i;
PPATRECT r;
PBRUSH pbrush; PBRUSH pbrush;
PDC_ATTR pdcattr; PDC pdc;
DC *dc;
dc = DC_LockDc(hDC); pdc = DC_LockDc(hDC);
if (dc == NULL) if (!pdc)
{ {
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
if (dc->dctype == DC_TYPE_INFO)
if (pdc->dctype == DC_TYPE_INFO)
{ {
DC_UnlockDc(dc); DC_UnlockDc(pdc);
/* Yes, Windows really returns TRUE in this case */ /* Yes, Windows really returns TRUE in this case */
return TRUE; return TRUE;
} }
pdcattr = dc->pdcattr; for (i = 0; i < cRects; i++)
if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
DC_vUpdateFillBrush(dc);
for (r = pRects, i = 0; i < cRects; i++)
{ {
pbrush = BRUSH_LockBrush(r->hBrush); pbrush = BRUSH_LockBrush(pRects->hBrush);
if(pbrush != NULL) if(pbrush != NULL)
{ {
IntPatBlt( IntPatBlt(
dc, pdc,
r->r.left, pRects->r.left,
r->r.top, pRects->r.top,
r->r.right, pRects->r.right,
r->r.bottom, pRects->r.bottom,
dwRop, dwRop,
pbrush); pbrush);
BRUSH_UnlockBrush(pbrush); BRUSH_UnlockBrush(pbrush);
} }
r++; pRects++;
} }
DC_UnlockDc(dc); DC_UnlockDc(pdc);
return TRUE; return TRUE;
} }