- 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);
}
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);
}

View file

@ -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;

View file

@ -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;
}

View file

@ -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;