Techwiki:DC State Saving

From ReactOS Wiki
Revision as of 22:58, 24 March 2009 by ThePhysicist (talk | contribs)
Jump to: navigation, search

DC State saving is done from SaveDC (NtGdiSaveDC), restoring from RestoreDC (NtGdiRestoreDC). The Saved levels form a linked list of HDCs, with the first saved state DC in the original DC's dclevel.hdcSave. Each Saved DC has this field set to the last DC that was saved before. The hdcSave field is initialized with 0. The dclevel.lSaveDepth specifies the DCs save level. It is initialized with 1 and grows by one each time you call SaveDC. After calling RestoreDC, it is restored to the requested level. Saved DCs don't belong to the current process. Instead they have a ProcessId of something like 0x80000012 (found on XP).

Saved content

The following fields are saved: DC.ppdev: either copied or initialized to the same value as the original DC DC.dclevel.hpal DC.dclevel.ppal DC.dclevel.pColorSpace DC.dclevel.lSaveDepth DC.dclevel.hdcSave DC.dclevel.pbrFill DC.dclevel.pbrLine DC.dclevel.pFont DC.dclevel.lapath (at least partly) DC.dclevel.ca DC.dclevel.mxWorldToDevice DC.dclevel.mxDeviceToWorld DC.dclevel.mxWorldToPage DC.dclevel.efM11PtoD DC.dclevel.efM22PtoD DC.dclevel.pSurface DC.dclevel.sizl

The following fields are not saved: DC.dhpdev DC.dctype DC.fs DC.hsem DC.flGraphicsCaps DC.flGraphicsCaps2 DC.pdcattr DC.erclClip DC.ptlDCOrig DC.erclWindow DC.erclBounds DC.erclBoundsApp DC.prgnVis DC.prgnRao DC.ptlFillOrigin DC.eboFill DC.eboLine DC.eboText DC.eboBackground DC.hlfntCur DC.co DC.ipfdDevMax DC.ulCopyCount

The following fields need investigation: DC.hdcNext DC.hdcPrev DC.prgnAPI DC.flSimulationFlags DC.lEscapement DC.prfnt DC.pPFFList DC.pClrxFormLnk DC.pSurfInfo DC.ptlDoBanding DC.dclevel.lIcmMode DC.dclevel.ptlBrushOrigin DC.dclevel.hpath DC.dclevel.flPath DC.dclevel.prgnClip DC.dclevel.prgnMeta DC.dclevel.flFontState DC.dclevel.ufi DC.dclevel.ufiLoc DC.dclevel.pUFI DC.dclevel.uNumUFIs DC.dclevel.ufiSet DC.dclevel.fl DC.dclevel.flbrush DC.dclevel.efDxPtoD DC.dclevel.efDyPtoD DC.dclevel.efM11_TWIPS DC.dclevel.efM22_TWIPS DC.dclevel.efPr11 DC.dclevel.efPr22 DC.pdcattr->pvLDC DC.pdcattr->ulDirty DC.pdcattr->hbrush DC.pdcattr->hpen DC.pdcattr->crBackgroundClr DC.pdcattr->ulBackgroundClr DC.pdcattr->crForegroundClr DC.pdcattr->ulForegroundClr DC.pdcattr->crBrushClr DC.pdcattr->ulBrushClr DC.pdcattr->crPenClr DC.pdcattr->ulPenClr DC.pdcattr->iCS_CP DC.pdcattr->iGraphicsMode DC.pdcattr->jROP2 DC.pdcattr->jBkMode DC.pdcattr->jFillMode DC.pdcattr->jStretchBltMode DC.pdcattr->ptlCurrent DC.pdcattr->ptfxCurrent DC.pdcattr->lBkMode DC.pdcattr->lFillMode DC.pdcattr->lStretchBltMode DC.pdcattr->flFontMapper DC.pdcattr->lIcmMode DC.pdcattr->hcmXform DC.pdcattr->hColorSpace DC.pdcattr->flIcmFlags DC.pdcattr->IcmBrushColor DC.pdcattr->IcmPenColor DC.pdcattr->pvLIcm DC.pdcattr->flTextAlign DC.pdcattr->lTextAlign DC.pdcattr->lTextExtra DC.pdcattr->lRelAbs DC.pdcattr->lBreakExtra DC.pdcattr->cBreak DC.pdcattr->hlfntNew DC.pdcattr->mxWorldToDevice DC.pdcattr->mxDeviceToWorld DC.pdcattr->mxWorldToPage DC.pdcattr->efM11PtoD DC.pdcattr->efM22PtoD DC.pdcattr->efDxPtoD DC.pdcattr->efDyPtoD DC.pdcattr->iMapMode DC.pdcattr->dwLayout DC.pdcattr->lWindowOrgx DC.pdcattr->ptlWindowOrg DC.pdcattr->szlWindowExt DC.pdcattr->ptlViewportOrg DC.pdcattr->szlViewportExt DC.pdcattr->flXform DC.pdcattr->szlVirtualDevicePixel DC.pdcattr->szlVirtualDeviceMm DC.pdcattr->szlVirtualDeviceSize DC.pdcattr->ptlBrushOrigin DC.pdcattr->VisRectRegion