* PROGRAMER: Timo Kreuzer (timo.kreuzer@rectos.org)
*/
-#include <w32k.h>
+#include <win32k.h>
#define NDEBUG
#include <debug.h>
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);
// FIXME: handle refs
pdcDst->dclevel.plfnt = pdcSrc->dclevel.plfnt;
- /* ROS hacks */
- if (pdcDst->dctype != DC_TYPE_MEMORY)
- {
- pdcDst->rosdc.bitsPerPixel = pdcSrc->rosdc.bitsPerPixel;
- }
-
/* Get/SetDCState() don't change hVisRgn field ("Undoc. Windows" p.559). */
if (To) // Copy "To" SaveDC state.
{
// Clean the DC
if (defaultDCstate) DC_vCopyState(defaultDCstate, dc, FALSE);
- if (dc->dctype != DC_TYPE_MEMORY)
- {
- dc->rosdc.bitsPerPixel = defaultDCstate->rosdc.bitsPerPixel;
- }
-
DC_UnlockDc(dc);
return TRUE;
IN PDC pdc,
INT iSaveLevel)
{
- PEPROCESS pepCurrentProcess;
HDC hdcSave;
PDC pdcSave;
ASSERT(iSaveLevel > 0);
DPRINT("DC_vRestoreDC(%p, %ld)\n", pdc->BaseObject.hHmgr, iSaveLevel);
- /* Get current process */
- pepCurrentProcess = PsGetCurrentProcess();
-
/* Loop the save levels */
while (pdc->dclevel.lSaveDepth > iSaveLevel)
{
DPRINT("RestoreDC = %p\n", hdcSave);
/* Set us as the owner */
- if (!GDIOBJ_SetOwnership(hdcSave, pepCurrentProcess))
+ if (!GreSetObjectOwner(hdcSave, GDI_OBJ_HMGR_POWNED))
{
/* Could not get ownership. That's bad! */
DPRINT1("Could not get ownership of saved DC (%p) for hdc %p!\n",
/* Copy the state back */
DC_vCopyState(pdcSave, pdc, FALSE);
+ /* Only memory DC's change their surface */
+ if (pdc->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)
/* Prevent save dc from being restored */
pdcSave->dclevel.lSaveDepth = 1;
+ /* Unlock it */
+ DC_UnlockDc(pdcSave);
/* Delete the saved dc */
GreDeleteObject(hdcSave);
}
pdc = DC_LockDc(hdc);
if (!pdc)
{
- SetLastWin32Error(ERROR_INVALID_HANDLE);
+ EngSetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
DPRINT("Illegal save level, requested: %ld, current: %ld\n",
iSaveLevel, pdc->dclevel.lSaveDepth);
DC_UnlockDc(pdc);
- SetLastWin32Error(ERROR_INVALID_PARAMETER);
+ EngSetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (pdc == NULL)
{
DPRINT("Could not lock DC\n");
- SetLastWin32Error(ERROR_INVALID_HANDLE);
+ EngSetLastError(ERROR_INVALID_HANDLE);
return 0;
}
InterlockedIncrement(&pdc->ppdev->cPdevRefs);
DC_vInitDc(pdcSave, DCTYPE_MEMORY, pdc->ppdev);
+ /* Handle references here correctly */
+// pdcSrc->dclevel.pSurface = NULL;
+// pdcSrc->dclevel.pbrFill = NULL;
+// pdcSrc->dclevel.pbrLine = NULL;
+// pdcSrc->dclevel.ppal = NULL;
+
/* Make it a kernel handle
(FIXME: windows handles this different, see wiki)*/
- GDIOBJ_SetOwnership(hdcSave, NULL);
+ GreSetObjectOwner(hdcSave, GDI_OBJ_HMGR_PUBLIC);
/* 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;