- 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
This commit is contained in:
Jérôme Gardou 2010-04-17 15:24:10 +00:00
parent 42073050d4
commit 663acbc064
4 changed files with 50 additions and 33 deletions

View file

@ -592,11 +592,7 @@ IntEngBitBltEx(
{ {
SURFACE_LockBitmapBits(psurfSrc); 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? */ /* Is the target surface device managed? */
@ -638,16 +634,13 @@ IntEngBitBltEx(
if (bRemoveMouse) if (bRemoveMouse)
{ {
MouseSafetyOnDrawEnd(psoTrg);
if (psoSrc) if (psoSrc)
{ {
MouseSafetyOnDrawEnd(psoSrc);
if (psoSrc != psoTrg) if (psoSrc != psoTrg)
{ {
SURFACE_UnlockBitmapBits(psurfSrc); SURFACE_UnlockBitmapBits(psurfSrc);
} }
} }
SURFACE_UnlockBitmapBits(psurfTrg); SURFACE_UnlockBitmapBits(psurfTrg);
} }

View file

@ -152,12 +152,12 @@ typedef struct _DC
/* Internal functions *********************************************************/ /* Internal functions *********************************************************/
#if 0 #if 1
#define DC_LockDc(hDC) \ #define DC_LockDc(hDC) \
((PDC) GDIOBJ_LockObj ((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC)) ((PDC) GDIOBJ_LockObj ((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC))
#define DC_UnlockDc(pDC) \ #define DC_UnlockDc(pDC) \
GDIOBJ_UnlockObjByPtr ((POBJ)pDC) GDIOBJ_UnlockObjByPtr ((POBJ)pDC)
#endif #else
VOID NTAPI EngAcquireSemaphoreShared(IN HSEMAPHORE hsem); VOID NTAPI EngAcquireSemaphoreShared(IN HSEMAPHORE hsem);
@ -196,6 +196,7 @@ DC_UnlockDc(PDC pdc)
GDIOBJ_UnlockObjByPtr(&pdc->BaseObject); GDIOBJ_UnlockObjByPtr(&pdc->BaseObject);
} }
#endif
extern PDC defaultDCstate; extern PDC defaultDCstate;

View file

@ -171,52 +171,60 @@ NtGdiBitBlt(
{ {
PDC DCDest; PDC DCDest;
PDC DCSrc = NULL; PDC DCSrc = NULL;
HDC ahDC[2];
PGDIOBJ apObj[2];
PDC_ATTR pdcattr = NULL; PDC_ATTR pdcattr = NULL;
SURFACE *BitmapDest, *BitmapSrc = NULL; SURFACE *BitmapDest, *BitmapSrc = NULL;
RECTL DestRect; RECTL DestRect, SourceRect;
POINTL SourcePoint; POINTL SourcePoint;
BOOL Status = FALSE; BOOL Status = FALSE;
EXLATEOBJ exlo; EXLATEOBJ exlo;
XLATEOBJ *XlateObj = NULL; XLATEOBJ *XlateObj = NULL;
BOOL UsesSource = ROP3_USES_SOURCE(ROP); 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 (NULL == DCDest)
{ {
if(DCSrc) GDIOBJ_UnlockObjByPtr(&DCSrc->BaseObject);
DPRINT("Invalid destination dc handle (0x%08x) passed to NtGdiBitBlt\n", hDCDest); DPRINT("Invalid destination dc handle (0x%08x) passed to NtGdiBitBlt\n", hDCDest);
return FALSE; return FALSE;
} }
if (DCDest->dctype == DC_TYPE_INFO) 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 */ /* Yes, Windows really returns TRUE in this case */
return TRUE; return TRUE;
} }
if (UsesSource) if (UsesSource)
{ {
if (hDCSrc != hDCDest)
{
DCSrc = DC_LockDc(hDCSrc);
if (NULL == DCSrc) if (NULL == DCSrc)
{ {
DC_UnlockDc(DCDest); GDIOBJ_UnlockObjByPtr(&DCDest->BaseObject);
DPRINT("Invalid source dc handle (0x%08x) passed to NtGdiBitBlt\n", hDCSrc); DPRINT("Invalid source dc handle (0x%08x) passed to NtGdiBitBlt\n", hDCSrc);
return FALSE; return FALSE;
} }
if (DCSrc->dctype == DC_TYPE_INFO) if (DCSrc->dctype == DC_TYPE_INFO)
{ {
DC_UnlockDc(DCSrc); GDIOBJ_UnlockObjByPtr(&DCDest->BaseObject);
DC_UnlockDc(DCDest); GDIOBJ_UnlockObjByPtr(&DCSrc->BaseObject);
/* Yes, Windows really returns TRUE in this case */ /* Yes, Windows really returns TRUE in this case */
return TRUE; return TRUE;
} }
} }
else else if(DCSrc)
{ {
DCSrc = DCDest; DPRINT1("Getting a valid Source handle without using source!!!");
} GDIOBJ_UnlockObjByPtr(&DCSrc->BaseObject);
DCSrc = NULL ;
} }
pdcattr = DCDest->pdcattr; pdcattr = DCDest->pdcattr;
@ -244,8 +252,16 @@ NtGdiBitBlt(
SourcePoint.x += DCSrc->ptlDCOrig.x; SourcePoint.x += DCSrc->ptlDCOrig.x;
SourcePoint.y += DCSrc->ptlDCOrig.y; 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 */ /* Determine surfaces to be used in the bitblt */
BitmapDest = DCDest->dclevel.pSurface; BitmapDest = DCDest->dclevel.pSurface;
if (!BitmapDest) if (!BitmapDest)
@ -280,14 +296,15 @@ NtGdiBitBlt(
&DCDest->dclevel.pbrFill->ptOrigin, &DCDest->dclevel.pbrFill->ptOrigin,
ROP3_TO_ROP4(ROP)); ROP3_TO_ROP4(ROP));
cleanup:
if (UsesSource) if (UsesSource)
EXLATEOBJ_vCleanup(&exlo); 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; return Status;
} }
@ -958,6 +975,8 @@ IntPatBlt(
EBRUSHOBJ_vInit(&eboFill, pbrush, pdc); EBRUSHOBJ_vInit(&eboFill, pbrush, pdc);
DC_vPrepareDCsForBlit(pdc, DestRect, NULL, DestRect);
ret = IntEngBitBlt( ret = IntEngBitBlt(
&psurf->SurfObj, &psurf->SurfObj,
NULL, NULL,
@ -973,6 +992,8 @@ IntPatBlt(
EBRUSHOBJ_vCleanup(&eboFill); EBRUSHOBJ_vCleanup(&eboFill);
DC_vFinishBlit(pdc, NULL);
return ret; return ret;
} }

View file

@ -115,11 +115,13 @@ DC_vInitDc(
DCTYPE dctype, DCTYPE dctype,
PPDEVOBJ ppdev) PPDEVOBJ ppdev)
{ {
#if 0
if (dctype == DCTYPE_DIRECT) if (dctype == DCTYPE_DIRECT)
{ {
/* Lock ppdev */ /* Lock ppdev */
EngAcquireSemaphoreShared(ppdev->hsemDevLock); EngAcquireSemaphoreShared(ppdev->hsemDevLock);
} }
#endif
/* Setup some basic fields */ /* Setup some basic fields */
pdc->dctype = dctype; pdc->dctype = dctype;