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) ; }
BOOL FASTCALL IntGdiCleanDC(HDC hDC) { PDC dc; if (!hDC) return FALSE; dc = DC_LockDc(hDC); if (!dc) return FALSE; // Clean the DC if (defaultDCstate) { DC_vCopyState(defaultDCstate, dc, FALSE); /* Update the brushes now, because they reference some objects (the DC palette) * Which belong to the current process, and this DC might be used for another process * after being cleaned up (for GetDC(0) for instance) */ DC_vUpdateFillBrush(dc); DC_vUpdateBackgroundBrush(dc); DC_vUpdateLineBrush(dc); DC_vUpdateTextBrush(dc); } // Remove Path and reset flags. if (dc->dclevel.hPath) { DPRINT("Clean DC Remove Path\n"); if (!PATH_Delete(dc->dclevel.hPath)) { DPRINT1("Failed to remove Path\n"); } dc->dclevel.hPath = 0; dc->dclevel.flPath = 0; } /* DC_vCopyState frees the Clip rgn and the Meta rgn. Take care of the other ones * There is no need to clear prgnVis, as UserGetDC updates it immediately. */ if (dc->prgnRao) REGION_Delete(dc->prgnRao); if (dc->prgnAPI) REGION_Delete(dc->prgnAPI); dc->prgnRao = dc->prgnAPI = NULL; dc->fs |= DC_FLAG_DIRTY_RAO; DC_UnlockDc(dc); return TRUE; }