From: Jérôme Gardou Date: Sat, 17 Apr 2010 15:24:10 +0000 (+0000) Subject: [WIN32K] X-Git-Tag: backups/reactos-yarotows@57446~177 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=663acbc064f8f860bf906faf8308061a66057df2 [WIN32K] - For now, limit DC_UnlockDc to a simple GDIOBJ_LockObj - More GDIOBJ_LockMultipleObj, DC_vPrepareDCsForBlit and DC_vFinishBlit fun svn path=/branches/reactos-yarotows/; revision=46906 --- diff --git a/subsystems/win32/win32k/eng/bitblt.c b/subsystems/win32/win32k/eng/bitblt.c index 3c65aaa6862..abcceec6785 100644 --- a/subsystems/win32/win32k/eng/bitblt.c +++ b/subsystems/win32/win32k/eng/bitblt.c @@ -592,11 +592,7 @@ IntEngBitBltEx( { SURFACE_LockBitmapBits(psurfSrc); } - MouseSafetyOnDrawStart(psoSrc, rclSrc.left, rclSrc.top, - rclSrc.right, rclSrc.bottom); } - MouseSafetyOnDrawStart(psoTrg, rclClipped.left, rclClipped.top, - rclClipped.right, rclClipped.bottom); } /* Is the target surface device managed? */ @@ -638,16 +634,13 @@ IntEngBitBltEx( if (bRemoveMouse) { - MouseSafetyOnDrawEnd(psoTrg); if (psoSrc) { - MouseSafetyOnDrawEnd(psoSrc); if (psoSrc != psoTrg) { SURFACE_UnlockBitmapBits(psurfSrc); } } - SURFACE_UnlockBitmapBits(psurfTrg); } diff --git a/subsystems/win32/win32k/include/dc.h b/subsystems/win32/win32k/include/dc.h index 0840c311eb3..6e5f9731e14 100644 --- a/subsystems/win32/win32k/include/dc.h +++ b/subsystems/win32/win32k/include/dc.h @@ -152,12 +152,12 @@ typedef struct _DC /* Internal functions *********************************************************/ -#if 0 +#if 1 #define DC_LockDc(hDC) \ ((PDC) GDIOBJ_LockObj ((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC)) #define DC_UnlockDc(pDC) \ GDIOBJ_UnlockObjByPtr ((POBJ)pDC) -#endif +#else VOID NTAPI EngAcquireSemaphoreShared(IN HSEMAPHORE hsem); @@ -196,6 +196,7 @@ DC_UnlockDc(PDC pdc) GDIOBJ_UnlockObjByPtr(&pdc->BaseObject); } +#endif extern PDC defaultDCstate; diff --git a/subsystems/win32/win32k/objects/bitblt.c b/subsystems/win32/win32k/objects/bitblt.c index 7df98ec53a8..9249b6657cd 100644 --- a/subsystems/win32/win32k/objects/bitblt.c +++ b/subsystems/win32/win32k/objects/bitblt.c @@ -171,53 +171,61 @@ NtGdiBitBlt( { PDC DCDest; PDC DCSrc = NULL; + HDC ahDC[2]; + PGDIOBJ apObj[2]; PDC_ATTR pdcattr = NULL; SURFACE *BitmapDest, *BitmapSrc = NULL; - RECTL DestRect; + RECTL DestRect, SourceRect; POINTL SourcePoint; BOOL Status = FALSE; EXLATEOBJ exlo; XLATEOBJ *XlateObj = NULL; BOOL UsesSource = ROP3_USES_SOURCE(ROP); - DCDest = DC_LockDc(hDCDest); + DPRINT("Locking DCs\n"); + ahDC[0] = hDCDest; + ahDC[1] = hDCSrc ; + GDIOBJ_LockMultipleObjs(2, ahDC, apObj); + DCDest = apObj[0]; + DCSrc = apObj[1]; + if (NULL == DCDest) { + if(DCSrc) GDIOBJ_UnlockObjByPtr(&DCSrc->BaseObject); DPRINT("Invalid destination dc handle (0x%08x) passed to NtGdiBitBlt\n", hDCDest); return FALSE; } if (DCDest->dctype == DC_TYPE_INFO) { - DC_UnlockDc(DCDest); + if(DCSrc) GDIOBJ_UnlockObjByPtr(&DCSrc->BaseObject); + GDIOBJ_UnlockObjByPtr(&DCDest->BaseObject); /* Yes, Windows really returns TRUE in this case */ return TRUE; } if (UsesSource) { - if (hDCSrc != hDCDest) + if (NULL == DCSrc) { - DCSrc = DC_LockDc(hDCSrc); - if (NULL == DCSrc) - { - DC_UnlockDc(DCDest); - DPRINT("Invalid source dc handle (0x%08x) passed to NtGdiBitBlt\n", hDCSrc); - return FALSE; - } - if (DCSrc->dctype == DC_TYPE_INFO) - { - DC_UnlockDc(DCSrc); - DC_UnlockDc(DCDest); - /* Yes, Windows really returns TRUE in this case */ - return TRUE; - } + GDIOBJ_UnlockObjByPtr(&DCDest->BaseObject); + DPRINT("Invalid source dc handle (0x%08x) passed to NtGdiBitBlt\n", hDCSrc); + return FALSE; } - else + if (DCSrc->dctype == DC_TYPE_INFO) { - DCSrc = DCDest; + GDIOBJ_UnlockObjByPtr(&DCDest->BaseObject); + GDIOBJ_UnlockObjByPtr(&DCSrc->BaseObject); + /* Yes, Windows really returns TRUE in this case */ + return TRUE; } } + else if(DCSrc) + { + DPRINT1("Getting a valid Source handle without using source!!!"); + GDIOBJ_UnlockObjByPtr(&DCSrc->BaseObject); + DCSrc = NULL ; + } pdcattr = DCDest->pdcattr; @@ -244,8 +252,16 @@ NtGdiBitBlt( SourcePoint.x += DCSrc->ptlDCOrig.x; SourcePoint.y += DCSrc->ptlDCOrig.y; + /* Calculate Source Rect */ + SourceRect.left = SourcePoint.x; + SourceRect.top = SourcePoint.y; + SourceRect.right = SourcePoint.x + DestRect.right - DestRect.left; + SourceRect.bottom = SourcePoint.y + DestRect.bottom - DestRect.top ; } + /* Prepare blit */ + DC_vPrepareDCsForBlit(DCDest, DestRect, DCSrc, SourceRect); + /* Determine surfaces to be used in the bitblt */ BitmapDest = DCDest->dclevel.pSurface; if (!BitmapDest) @@ -280,14 +296,15 @@ NtGdiBitBlt( &DCDest->dclevel.pbrFill->ptOrigin, ROP3_TO_ROP4(ROP)); -cleanup: if (UsesSource) EXLATEOBJ_vCleanup(&exlo); - if (UsesSource && hDCSrc != hDCDest) +cleanup: + DC_vFinishBlit(DCDest, DCSrc); + if (UsesSource) { - DC_UnlockDc(DCSrc); + GDIOBJ_UnlockObjByPtr(&DCSrc->BaseObject); } - DC_UnlockDc(DCDest); + GDIOBJ_UnlockObjByPtr(&DCDest->BaseObject); return Status; } @@ -958,6 +975,8 @@ IntPatBlt( EBRUSHOBJ_vInit(&eboFill, pbrush, pdc); + DC_vPrepareDCsForBlit(pdc, DestRect, NULL, DestRect); + ret = IntEngBitBlt( &psurf->SurfObj, NULL, @@ -973,6 +992,8 @@ IntPatBlt( EBRUSHOBJ_vCleanup(&eboFill); + DC_vFinishBlit(pdc, NULL); + return ret; } diff --git a/subsystems/win32/win32k/objects/dclife.c b/subsystems/win32/win32k/objects/dclife.c index b93ba336d36..5b8636f9c3e 100644 --- a/subsystems/win32/win32k/objects/dclife.c +++ b/subsystems/win32/win32k/objects/dclife.c @@ -115,11 +115,13 @@ DC_vInitDc( DCTYPE dctype, PPDEVOBJ ppdev) { +#if 0 if (dctype == DCTYPE_DIRECT) { /* Lock ppdev */ EngAcquireSemaphoreShared(ppdev->hsemDevLock); } +#endif /* Setup some basic fields */ pdc->dctype = dctype;