From 416711ec61eaade37b9ca8ff9120fdd3ee8d0ccd Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 26 Apr 2012 09:30:15 +0000 Subject: [PATCH] [WIN32K] Pass EBRUSHOBJ to IntPatBlt instead of the BRUSH. This way we can use the DC's eboFill, instead of initializing a new EBRUSHOBJ. svn path=/trunk/; revision=56427 --- reactos/win32ss/gdi/ntgdi/bitblt.c | 42 ++++++++++++------------------ 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/reactos/win32ss/gdi/ntgdi/bitblt.c b/reactos/win32ss/gdi/ntgdi/bitblt.c index 3663d06e6b3..76c5dca6ffa 100644 --- a/reactos/win32ss/gdi/ntgdi/bitblt.c +++ b/reactos/win32ss/gdi/ntgdi/bitblt.c @@ -733,15 +733,15 @@ IntPatBlt( INT Width, INT Height, DWORD dwRop, - PBRUSH pbrush) + PEBRUSHOBJ pebo) { RECTL DestRect; SURFACE *psurf; - EBRUSHOBJ eboFill ; POINTL BrushOrigin; BOOL ret; + PBRUSH pbrush = pebo->pbrush; - ASSERT(pbrush); + ASSERT(pebo); FIXUP_ROP(dwRop); @@ -790,11 +790,6 @@ IntPatBlt( psurf = pdc->dclevel.pSurface; - if (pdc->pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY)) - DC_vUpdateFillBrush(pdc); - - EBRUSHOBJ_vInit(&eboFill, pbrush, pdc); - ret = IntEngBitBlt( &psurf->SurfObj, NULL, @@ -804,14 +799,12 @@ IntPatBlt( &DestRect, NULL, NULL, - &eboFill.BrushObject, + &pebo->BrushObject, &BrushOrigin, ROP_TO_ROP4(dwRop)); DC_vFinishBlit(pdc, NULL); - EBRUSHOBJ_vCleanup(&eboFill); - return ret; } @@ -826,6 +819,7 @@ IntGdiPolyPatBlt( INT i; PBRUSH pbrush; PDC pdc; + EBRUSHOBJ eboFill; pdc = DC_LockDc(hDC); if (!pdc) @@ -844,8 +838,13 @@ IntGdiPolyPatBlt( for (i = 0; i < cRects; i++) { pbrush = BRUSH_ShareLockBrush(pRects->hBrush); - if(pbrush != NULL) + + /* Check if we could lock the brush */ + if (pbrush != NULL) { + /* Initialize a brush object */ + EBRUSHOBJ_vInit(&eboFill, pbrush, pdc); + IntPatBlt( pdc, pRects->r.left, @@ -853,7 +852,10 @@ IntGdiPolyPatBlt( pRects->r.right, pRects->r.bottom, dwRop, - pbrush); + &eboFill); + + /* Cleanup the brush object and unlock the brush */ + EBRUSHOBJ_vCleanup(&eboFill); BRUSH_ShareUnlockBrush(pbrush); } pRects++; @@ -873,7 +875,6 @@ NtGdiPatBlt( INT Height, DWORD ROP) { - PBRUSH pbrush; DC *dc; PDC_ATTR pdcattr; BOOL ret; @@ -885,8 +886,6 @@ NtGdiPatBlt( return NtGdiMaskBlt(hDC, XLeft, YLeft, Width, Height, 0,0,0,0,0,0,ROP,0); } -if ((XLeft == 0) && (YLeft == 0) && (Width == 592) && (Height == 362)) __debugbreak(); - dc = DC_LockDc(hDC); if (dc == NULL) { @@ -906,17 +905,8 @@ if ((XLeft == 0) && (YLeft == 0) && (Width == 592) && (Height == 362)) __debugbr if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY)) DC_vUpdateFillBrush(dc); - pbrush = BRUSH_ShareLockBrush(pdcattr->hbrush); - if (pbrush == NULL) - { - EngSetLastError(ERROR_INVALID_HANDLE); - DC_UnlockDc(dc); - return FALSE; - } + ret = IntPatBlt(dc, XLeft, YLeft, Width, Height, ROP, &dc->eboFill); - ret = IntPatBlt(dc, XLeft, YLeft, Width, Height, ROP, pbrush); - - BRUSH_ShareUnlockBrush(pbrush); DC_UnlockDc(dc); return ret;