Difference between revisions of "Techwiki:DC State Saving"

From ReactOS Wiki
Jump to: navigation, search
Line 5: Line 5:
 
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.
 
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 DCs don't belong to the current process. Instead they have a ProcessId of something like 0x80000012 (found on XP).
After restoring the state, ulDirty flags are set: 0x0012001f
+
After restoring the state, ulDirty flags are set: 0x0012001f (
 +
(DIRTY_FILL 0x01 | DIRTY_LINE 0x02 | DIRTY_TEXT 0x04 | DIRTY_BACKGROUND 0x08 | DIRTY_CHARSET 0x10 | 0x20000).
  
 
===Saved content===
 
===Saved content===

Revision as of 23:55, 24 March 2009

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). After restoring the state, ulDirty flags are set: 0x0012001f ( (DIRTY_FILL 0x01 | DIRTY_LINE 0x02 | DIRTY_TEXT 0x04 | DIRTY_BACKGROUND 0x08 | DIRTY_CHARSET 0x10 | 0x20000).

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
  • DC.pdc->pdcattr (full dcattr is copied, only some fields in VisRectRegion seem to be restored to a valid state)

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