mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-03 04:13:31 +00:00
[WIN32K]
- clean up some unused code - use GDIOBJ_IncrementShareCount on Timo suggestion - use ppdev semaphore as sort criterion in DC_vPrepareDCsForBlit, spotted by Timo - Get ownership before freeing the object in GDIOBJ_ShareUnlockObjByPtr, as whoever set it ready to die had the right to svn path=/branches/reactos-yarotows/; revision=47205
This commit is contained in:
@@ -152,52 +152,10 @@ typedef struct _DC
|
||||
|
||||
/* Internal functions *********************************************************/
|
||||
|
||||
#if 1
|
||||
#define DC_LockDc(hDC) \
|
||||
((PDC) GDIOBJ_LockObj ((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC))
|
||||
#define DC_UnlockDc(pDC) \
|
||||
GDIOBJ_UnlockObjByPtr ((POBJ)pDC)
|
||||
#else
|
||||
|
||||
VOID NTAPI EngAcquireSemaphoreShared(IN HSEMAPHORE hsem);
|
||||
|
||||
PDC
|
||||
FORCEINLINE
|
||||
DC_LockDc(HDC hdc)
|
||||
{
|
||||
PDC pdc;
|
||||
pdc = GDIOBJ_LockObj(hdc, GDILoObjType_LO_DC_TYPE);
|
||||
|
||||
/* Direct DC's need PDEV locking */
|
||||
if(pdc && pdc->dctype == DCTYPE_DIRECT)
|
||||
{
|
||||
/* Acquire shared PDEV lock */
|
||||
EngAcquireSemaphoreShared(pdc->ppdev->hsemDevLock);
|
||||
|
||||
/* Update Surface if needed */
|
||||
if(pdc->dclevel.pSurface != pdc->ppdev->pSurface)
|
||||
{
|
||||
if(pdc->dclevel.pSurface) SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface);
|
||||
pdc->dclevel.pSurface = PDEVOBJ_pSurface(pdc->ppdev);
|
||||
}
|
||||
}
|
||||
return pdc;
|
||||
}
|
||||
|
||||
void
|
||||
FORCEINLINE
|
||||
DC_UnlockDc(PDC pdc)
|
||||
{
|
||||
if(pdc->dctype == DCTYPE_DIRECT)
|
||||
{
|
||||
/* Release PDEV lock */
|
||||
EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
|
||||
}
|
||||
|
||||
GDIOBJ_UnlockObjByPtr(&pdc->BaseObject);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
extern PDC defaultDCstate;
|
||||
|
||||
|
||||
@@ -113,6 +113,7 @@ GDIOBJ_ShareUnlockObjByPtr(POBJ Object)
|
||||
ASSERT(cLocks >= 0);
|
||||
if ((flags & BASEFLAG_READY_TO_DIE) && (cLocks == 0))
|
||||
{
|
||||
GDIOBJ_SetOwnership(hobj, PsGetCurrentProcess());
|
||||
GDIOBJ_FreeObjByHandle(hobj, GDI_OBJECT_TYPE_DONTCARE);
|
||||
}
|
||||
return cLocks;
|
||||
|
||||
@@ -95,7 +95,7 @@ IntGdiCreateBitmap(
|
||||
{
|
||||
case 1:
|
||||
psurfBmp->ppal = &gpalMono;
|
||||
gpalMono.BaseObject.ulShareCount++;
|
||||
GDIOBJ_IncrementShareCount((POBJ)&gpalMono);
|
||||
break;
|
||||
case 4:
|
||||
case 8:
|
||||
@@ -103,16 +103,15 @@ IntGdiCreateBitmap(
|
||||
break;
|
||||
case 15:
|
||||
psurfBmp->ppal = &gpalRGB555;
|
||||
gpalRGB555.BaseObject.ulShareCount++;
|
||||
GDIOBJ_IncrementShareCount((POBJ)&gpalRGB555);
|
||||
break;
|
||||
case 16:
|
||||
psurfBmp->ppal = &gpalRGB565;
|
||||
gpalRGB565.BaseObject.ulShareCount++;
|
||||
break;
|
||||
GDIOBJ_IncrementShareCount((POBJ)&gpalRGB565);
|
||||
case 24:
|
||||
case 32:
|
||||
psurfBmp->ppal = &gpalRGB;
|
||||
gpalRGB.BaseObject.ulShareCount++;
|
||||
GDIOBJ_IncrementShareCount((POBJ)&gpalRGB);
|
||||
break;
|
||||
default:
|
||||
DPRINT1("Could not determine palette for bit depth %u.\n", BitsPixel);
|
||||
|
||||
@@ -115,14 +115,6 @@ 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;
|
||||
pdc->ppdev = ppdev;
|
||||
@@ -496,7 +488,7 @@ DC_vPrepareDCsForBlit(PDC pdc1,
|
||||
/* Lock them in good order */
|
||||
if(pdc2)
|
||||
{
|
||||
if((ULONG_PTR)pdc1->BaseObject.hHmgr >= (ULONG_PTR)pdc2->BaseObject.hHmgr)
|
||||
if((ULONG_PTR)pdc1->ppdev->hsemDevLock >= (ULONG_PTR)pdc2->ppdev->hsemDevLock)
|
||||
{
|
||||
pdcFirst = pdc1;
|
||||
prcFirst = &rc1;
|
||||
|
||||
Reference in New Issue
Block a user