BOOL NTAPI DC_Cleanup(PVOID ObjectBody) { PDC pdc = (PDC)ObjectBody; /* Free DC_ATTR */ DC_vFreeDcAttr(pdc); /* Delete saved DCs */ DC_vRestoreDC(pdc, 1); /* Deselect dc objects */ DC_vSelectSurface(pdc, NULL); DC_vSelectFillBrush(pdc, NULL); DC_vSelectLineBrush(pdc, NULL); DC_vSelectPalette(pdc, NULL); /* Cleanup the dc brushes */ EBRUSHOBJ_vCleanup(&pdc->eboFill); EBRUSHOBJ_vCleanup(&pdc->eboLine); EBRUSHOBJ_vCleanup(&pdc->eboText); EBRUSHOBJ_vCleanup(&pdc->eboBackground); /* Release font */ LFONT_ShareUnlockFont(pdc->dclevel.plfnt); /* Free regions */ if (pdc->rosdc.hClipRgn && GreIsHandleValid(pdc->rosdc.hClipRgn)) GreDeleteObject(pdc->rosdc.hClipRgn); if (pdc->prgnVis) { REGION_Delete(pdc->prgnVis); } if (pdc->rosdc.hGCClipRgn && GreIsHandleValid(pdc->rosdc.hGCClipRgn)) { GreDeleteObject(pdc->rosdc.hGCClipRgn); } if (NULL != pdc->rosdc.CombinedClip) IntEngDeleteClipRegion(pdc->rosdc.CombinedClip); PATH_Delete(pdc->dclevel.hPath); if(pdc->dclevel.pSurface) SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface); PDEVOBJ_vRelease(pdc->ppdev) ; return TRUE; }
VOID NTAPI DC_vCleanup(PVOID ObjectBody) { PDC pdc = (PDC)ObjectBody; /* Free DC_ATTR */ DC_vFreeDcAttr(pdc); /* Delete saved DCs */ DC_vRestoreDC(pdc, 1); /* Deselect dc objects */ DC_vSelectSurface(pdc, NULL); DC_vSelectFillBrush(pdc, NULL); DC_vSelectLineBrush(pdc, NULL); DC_vSelectPalette(pdc, NULL); /* Cleanup the dc brushes */ EBRUSHOBJ_vCleanup(&pdc->eboFill); EBRUSHOBJ_vCleanup(&pdc->eboLine); EBRUSHOBJ_vCleanup(&pdc->eboText); EBRUSHOBJ_vCleanup(&pdc->eboBackground); /* Release font */ LFONT_ShareUnlockFont(pdc->dclevel.plfnt); /* Free regions */ if (pdc->dclevel.prgnClip) REGION_Delete(pdc->dclevel.prgnClip); if (pdc->dclevel.prgnMeta) REGION_Delete(pdc->dclevel.prgnMeta); if (pdc->prgnVis) REGION_Delete(pdc->prgnVis); if (pdc->prgnRao) REGION_Delete(pdc->prgnRao); if (pdc->prgnAPI) REGION_Delete(pdc->prgnAPI); /* Free CLIPOBJ resources */ IntEngFreeClipResources(&pdc->co); PATH_Delete(pdc->dclevel.hPath); if(pdc->dclevel.pSurface) SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface); PDEVOBJ_vRelease(pdc->ppdev) ; }
VOID NTAPI DC_vSetOwner(PDC pdc, ULONG ulOwner) { if (pdc->rosdc.hClipRgn) { IntGdiSetRegionOwner(pdc->rosdc.hClipRgn, ulOwner); } if (pdc->rosdc.hGCClipRgn) { IntGdiSetRegionOwner(pdc->rosdc.hGCClipRgn, ulOwner); } if (pdc->dclevel.hPath) { GreSetObjectOwner(pdc->dclevel.hPath, ulOwner); } /* Dereference current brush and pen */ BRUSH_ShareUnlockBrush(pdc->dclevel.pbrFill); BRUSH_ShareUnlockBrush(pdc->dclevel.pbrLine); /* Select the default fill and line brush */ pdc->dcattr.hbrush = StockObjects[WHITE_BRUSH]; pdc->dcattr.hpen = StockObjects[BLACK_PEN]; pdc->dclevel.pbrFill = BRUSH_ShareLockBrush(pdc->pdcattr->hbrush); pdc->dclevel.pbrLine = PEN_ShareLockPen(pdc->pdcattr->hpen); /* Mark them as dirty */ pdc->pdcattr->ulDirty_ |= DIRTY_FILL|DIRTY_LINE; /* Allocate or free DC attribute */ if (ulOwner == GDI_OBJ_HMGR_PUBLIC || ulOwner == GDI_OBJ_HMGR_NONE) { if (pdc->pdcattr != &pdc->dcattr) DC_vFreeDcAttr(pdc); } else if (ulOwner == GDI_OBJ_HMGR_POWNED) { if (pdc->pdcattr == &pdc->dcattr) DC_bAllocDcAttr(pdc); } /* Set the DC's ownership */ GDIOBJ_vSetObjectOwner(&pdc->BaseObject, ulOwner); }
VOID NTAPI DC_vSetOwner(PDC pdc, ULONG ulOwner) { if (pdc->rosdc.hClipRgn) { IntGdiSetRegionOwner(pdc->rosdc.hClipRgn, ulOwner); } if (pdc->rosdc.hGCClipRgn) { IntGdiSetRegionOwner(pdc->rosdc.hGCClipRgn, ulOwner); } if (pdc->dclevel.hPath) { GreSetObjectOwner(pdc->dclevel.hPath, ulOwner); } IntGdiSetBrushOwner(pdc->dclevel.pbrFill, ulOwner); IntGdiSetBrushOwner(pdc->dclevel.pbrLine, ulOwner); /* Allocate or free DC attribute */ if (ulOwner == GDI_OBJ_HMGR_PUBLIC || ulOwner == GDI_OBJ_HMGR_NONE) { if (pdc->pdcattr != &pdc->dcattr) DC_vFreeDcAttr(pdc); } else if (ulOwner == GDI_OBJ_HMGR_POWNED) { if (pdc->pdcattr == &pdc->dcattr) DC_bAllocDcAttr(pdc); } /* Set the DC's ownership */ GDIOBJ_vSetObjectOwner(&pdc->BaseObject, ulOwner); }