- EngAcquireSemaphoreShared: update dwEngAcquireCount
- DC_LockDc/DC_UnlockDc: Acquire PDEV lock only for direct DCs, in that case also update the pSurface pointer
- When copying DC states, copy the surface only for memory dcs
- after switching the mode, update system metrics and redraw the desktop window.
- Remove testdraw code.
svn path=/branches/reactos-yarotows/; revision=46658
ppdev2->pfn.CompletePDEV(ppdev2->dhpdev, (HDEV)ppdev2);
}
ppdev2->pfn.CompletePDEV(ppdev2->dhpdev, (HDEV)ppdev2);
}
-void
-TestDraw()
-{
- RECTL rclTrg;
- PPDEVOBJ ppdev;
- PDC pdc;
-
- ppdev = EngpGetPDEV(0);
-
- pdc = DC_AllocDcWithHandle();
- DC_vInitDc(pdc, 0, ppdev);
-
-
- rclTrg.left = rclTrg.top = 0;
- rclTrg.right = rclTrg.bottom = 400;
-
- IntEngBitBltEx(&ppdev->pSurface->SurfObj,
- NULL,
- NULL,
- NULL,
- NULL,
- &rclTrg,
- NULL,
- NULL,
- &pdc->eboFill.BrushObject,
- NULL,
- ROP3_TO_ROP4(PATCOPY),
- FALSE);
-
- ASSERT(FALSE);
-}
DPRINT1("leave, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
ASSERT(ppdev->pSurface->BitsLock);
DPRINT1("leave, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
ASSERT(ppdev->pSurface->BitsLock);
EngAcquireSemaphoreShared(
IN HSEMAPHORE hsem)
{
EngAcquireSemaphoreShared(
IN HSEMAPHORE hsem)
{
ASSERT(hsem);
ExEnterCriticalRegionAndAcquireResourceShared((PERESOURCE)hsem);
ASSERT(hsem);
ExEnterCriticalRegionAndAcquireResourceShared((PERESOURCE)hsem);
+ pti = PsGetThreadWin32Thread(PsGetCurrentThread());
+ if (pti) ++pti->dwEngAcquireCount;
{
PDC pdc;
pdc = GDIOBJ_LockObj(hdc, GDILoObjType_LO_DC_TYPE);
{
PDC pdc;
pdc = GDIOBJ_LockObj(hdc, GDILoObjType_LO_DC_TYPE);
- if(pdc) EngAcquireSemaphoreShared(pdc->ppdev->hsemDevLock);
+
+ /* Direct DC's need PDEV locking */
+ if(pdc && pdc->dctype == DCTYPE_DIRECT)
+ {
+ /* Acquire shared PDEV lock */
+ EngAcquireSemaphoreShared(pdc->ppdev->hsemDevLock);
+
+ /* Get the current surface */
+ pdc->dclevel.pSurface = pdc->ppdev->pSurface;
+ }
FORCEINLINE
DC_UnlockDc(PDC pdc)
{
FORCEINLINE
DC_UnlockDc(PDC pdc)
{
- EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
+ if(pdc->dctype == DCTYPE_DIRECT)
+ {
+ /* Release PDEV lock */
+ EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
+ }
+
GDIOBJ_UnlockObjByPtr(&pdc->BaseObject);
}
GDIOBJ_UnlockObjByPtr(&pdc->BaseObject);
}
+BOOL APIENTRY UserClipCursor(RECTL *prcl);
+VOID APIENTRY UserRedrawDesktop();
HKEY hkey;
NTSTATUS Status;
PPDEVOBJ ppdev;
HKEY hkey;
NTSTATUS Status;
PPDEVOBJ ppdev;
/* If no DEVMODE is given, use registry settings */
if (!pdm)
/* If no DEVMODE is given, use registry settings */
if (!pdm)
DISP_CHANGE_FAILED : DISP_CHANGE_RESTART;
}
DISP_CHANGE_FAILED : DISP_CHANGE_RESTART;
}
+ /* Update the system metrics */
+ InitMetrics();
+
+ /* Remove all cursor clipping */
+ UserClipCursor(NULL);
+
+ pdesk = IntGetActiveDesktop();
+ IntHideDesktop(pdesk);
+ co_IntShowDesktop(pdesk, ppdev->gdiinfo.ulHorzRes, ppdev->gdiinfo.ulVertRes);
+ //UserRedrawDesktop();
+
+ //IntvGetDeviceCaps(&PrimarySurface, &GdiHandleTable->DevCaps);
+
}
// FIXME: Copy videoparameters
}
// FIXME: Copy videoparameters
/* Call internal function */
Ret = UserChangeDisplaySettings(pustrDevice, lpDevMode, hwnd, dwflags, NULL);
/* Call internal function */
Ret = UserChangeDisplaySettings(pustrDevice, lpDevMode, hwnd, dwflags, NULL);
DCTYPE dctype,
PPDEVOBJ ppdev)
{
DCTYPE dctype,
PPDEVOBJ ppdev)
{
- /* Lock ppdev */
- EngAcquireSemaphoreShared(ppdev->hsemDevLock);
+ if (dctype == DCTYPE_DIRECT)
+ {
+ /* Lock ppdev */
+ EngAcquireSemaphoreShared(ppdev->hsemDevLock);
+ }
/* Setup some basic fields */
pdc->dctype = dctype;
/* Setup some basic fields */
pdc->dctype = dctype;
pdcDst->dclevel.hpal = pdcSrc->dclevel.hpal;
/* Handle references here correctly */
pdcDst->dclevel.hpal = pdcSrc->dclevel.hpal;
/* Handle references here correctly */
- DC_vSelectSurface(pdcDst, pdcSrc->dclevel.pSurface);
DC_vSelectFillBrush(pdcDst, pdcSrc->dclevel.pbrFill);
DC_vSelectLineBrush(pdcDst, pdcSrc->dclevel.pbrLine);
DC_vSelectPalette(pdcDst, pdcSrc->dclevel.ppal);
DC_vSelectFillBrush(pdcDst, pdcSrc->dclevel.pbrFill);
DC_vSelectLineBrush(pdcDst, pdcSrc->dclevel.pbrLine);
DC_vSelectPalette(pdcDst, pdcSrc->dclevel.ppal);
/* Copy the state back */
DC_vCopyState(pdcSave, pdc, FALSE);
/* Copy the state back */
DC_vCopyState(pdcSave, pdc, FALSE);
+ /* Only memory DC's change their surface */
+ if (pdcSave->dctype == DCTYPE_MEMORY)
+ DC_vSelectSurface(pdc, pdcSave->dclevel.pSurface);
+
// Restore Path by removing it, if the Save flag is set.
// BeginPath will takecare of the rest.
if (pdc->dclevel.hPath && pdc->dclevel.flPath & DCPATH_SAVE)
// Restore Path by removing it, if the Save flag is set.
// BeginPath will takecare of the rest.
if (pdc->dclevel.hPath && pdc->dclevel.flPath & DCPATH_SAVE)
/* Copy the current state */
DC_vCopyState(pdc, pdcSave, TRUE);
/* Copy the current state */
DC_vCopyState(pdc, pdcSave, TRUE);
+ /* Only memory DC's change their surface */
+ if (pdc->dctype == DCTYPE_MEMORY)
+ DC_vSelectSurface(pdcSave, pdc->dclevel.pSurface);
+
/* Copy path. FIXME: why this way? */
pdcSave->dclevel.hPath = pdc->dclevel.hPath;
pdcSave->dclevel.flPath = pdc->dclevel.flPath | DCPATH_SAVESTATE;
/* Copy path. FIXME: why this way? */
pdcSave->dclevel.hPath = pdc->dclevel.hPath;
pdcSave->dclevel.flPath = pdc->dclevel.flPath | DCPATH_SAVESTATE;