/* * @implemented */ BOOL APIENTRY CLIPOBJ_bEnum( IN CLIPOBJ* ClipObj, IN ULONG ObjSize, OUT ULONG *EnumRects) { RECTL *dest, *src; CLIPGDI *ClipGDI = ObjToGDI(ClipObj, CLIP); ULONG nCopy, i; ENUMRECTS* pERects = (ENUMRECTS*)EnumRects; //calculate how many rectangles we should copy nCopy = min( ClipGDI->EnumMax - ClipGDI->EnumPos, min( ClipGDI->EnumRects.c - ClipGDI->EnumPos, (ObjSize - sizeof(ULONG)) / sizeof(RECTL))); if(nCopy == 0) { return FALSE; } /* copy rectangles */ src = ClipGDI->EnumRects.arcl + ClipGDI->EnumPos; for(i = 0, dest = pERects->arcl; i < nCopy; i++, dest++, src++) { *dest = *src; } pERects->c = nCopy; ClipGDI->EnumPos+=nCopy; return ClipGDI->EnumPos < ClipGDI->EnumRects.c; }
/* * Calls the WNDOBJCHANGEPROC of the given WNDOBJ */ VOID FASTCALL IntEngWndCallChangeProc( IN WNDOBJ *pwo, IN FLONG flChanged) { WNDGDI *WndObjInt = ObjToGDI(pwo, WND); if (WndObjInt->ChangeProc == NULL) { return; } /* check flags of the WNDOBJ */ flChanged &= WndObjInt->Flags; if (flChanged == 0) { return; } /* Call the WNDOBJCHANGEPROC */ if (flChanged == WOC_CHANGED) { pwo = NULL; } DPRINT("Calling WNDOBJCHANGEPROC (0x%p), Changed = 0x%x\n", WndObjInt->ChangeProc, flChanged); WndObjInt->ChangeProc(pwo, flChanged); }
/* * @implemented */ VOID APIENTRY EngDeleteClip( _In_ _Post_ptr_invalid_ CLIPOBJ *pco) { EngFreeMem(ObjToGDI(pco, CLIP)); }
/* * @implemented */ ULONG APIENTRY CLIPOBJ_cEnumStart( _Inout_ CLIPOBJ *pco, _In_ BOOL bAll, _In_ ULONG iType, _In_ ULONG iDirection, _In_ ULONG cMaxRects) { CLIPGDI *ClipGDI = ObjToGDI(pco, CLIP); SORTCOMP CompareFunc; ClipGDI->EnumPos = 0; ClipGDI->EnumMax = (cMaxRects > 0) ? cMaxRects : ClipGDI->EnumRects.c; if (CD_ANY != iDirection && ClipGDI->EnumOrder != iDirection) { switch (iDirection) { case CD_RIGHTDOWN: CompareFunc = (SORTCOMP) CompareRightDown; break; case CD_RIGHTUP: CompareFunc = (SORTCOMP) CompareRightUp; break; case CD_LEFTDOWN: CompareFunc = (SORTCOMP) CompareLeftDown; break; case CD_LEFTUP: CompareFunc = (SORTCOMP) CompareLeftUp; break; default: DPRINT1("Invalid iDirection %lu\n", iDirection); iDirection = ClipGDI->EnumOrder; CompareFunc = NULL; break; } if (NULL != CompareFunc) { EngSort((PBYTE) ClipGDI->EnumRects.arcl, sizeof(RECTL), ClipGDI->EnumRects.c, CompareFunc); } ClipGDI->EnumOrder = iDirection; } /* Return the number of rectangles enumerated */ if ((cMaxRects > 0) && (ClipGDI->EnumRects.c > cMaxRects)) { return 0xFFFFFFFF; } return ClipGDI->EnumRects.c; }
/* * @implemented */ ULONG APIENTRY CLIPOBJ_cEnumStart( IN CLIPOBJ* ClipObj, IN BOOL ShouldDoAll, IN ULONG ClipType, IN ULONG BuildOrder, IN ULONG MaxRects) { CLIPGDI *ClipGDI = ObjToGDI(ClipObj, CLIP); SORTCOMP CompareFunc; ClipGDI->EnumPos = 0; ClipGDI->EnumMax = (MaxRects > 0) ? MaxRects : ClipGDI->EnumRects.c; if (CD_ANY != BuildOrder && ClipGDI->EnumOrder != BuildOrder) { switch (BuildOrder) { case CD_RIGHTDOWN: CompareFunc = (SORTCOMP) CompareRightDown; break; case CD_RIGHTUP: CompareFunc = (SORTCOMP) CompareRightUp; break; case CD_LEFTDOWN: CompareFunc = (SORTCOMP) CompareLeftDown; break; case CD_LEFTUP: CompareFunc = (SORTCOMP) CompareLeftUp; break; default: DPRINT1("Invalid BuildOrder %d\n", BuildOrder); BuildOrder = ClipGDI->EnumOrder; CompareFunc = NULL; break; } if (NULL != CompareFunc) { EngSort((PBYTE) ClipGDI->EnumRects.arcl, sizeof(RECTL), ClipGDI->EnumRects.c, CompareFunc); } ClipGDI->EnumOrder = BuildOrder; } /* Return the number of rectangles enumerated */ if ((MaxRects > 0) && (ClipGDI->EnumRects.c > MaxRects)) { return 0xFFFFFFFF; } return ClipGDI->EnumRects.c; }
DWORD FASTCALL GreGetKerningPairs( HDC hDC, ULONG NumPairs, LPKERNINGPAIR krnpair) { PDC dc; PDC_ATTR pdcattr; PTEXTOBJ TextObj; PFONTGDI FontGDI; DWORD Count; KERNINGPAIR *pKP; dc = DC_LockDc(hDC); if (!dc) { EngSetLastError(ERROR_INVALID_HANDLE); return 0; } pdcattr = dc->pdcattr; TextObj = RealizeFontInit(pdcattr->hlfntNew); DC_UnlockDc(dc); if (!TextObj) { EngSetLastError(ERROR_INVALID_HANDLE); return 0; } FontGDI = ObjToGDI(TextObj->Font, FONT); TEXTOBJ_UnlockText(TextObj); Count = ftGdiGetKerningPairs(FontGDI,0,NULL); if ( Count && krnpair ) { if (Count > NumPairs) { EngSetLastError(ERROR_INSUFFICIENT_BUFFER); return 0; } pKP = ExAllocatePoolWithTag(PagedPool, Count * sizeof(KERNINGPAIR), GDITAG_TEXT); if (!pKP) { EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); return 0; } ftGdiGetKerningPairs(FontGDI,Count,pKP); RtlCopyMemory(krnpair, pKP, Count * sizeof(KERNINGPAIR)); ExFreePoolWithTag(pKP,GDITAG_TEXT); } return Count; }
/* * @implemented */ BOOL APIENTRY WNDOBJ_bEnum( IN WNDOBJ *pwo, IN ULONG cj, OUT ULONG *pul) { WNDGDI *WndObjInt = ObjToGDI(pwo, WND); BOOL Ret; DPRINT("WNDOBJ_bEnum: pwo = 0x%p, cj = %lu, pul = 0x%p\n", pwo, cj, pul); Ret = CLIPOBJ_bEnum(WndObjInt->ClientClipObj, cj, pul); DPRINT("WNDOBJ_bEnum: Returning %s\n", Ret ? "True" : "False"); return Ret; }
/* * @implemented */ ULONG APIENTRY WNDOBJ_cEnumStart( IN WNDOBJ *pwo, IN ULONG iType, IN ULONG iDirection, IN ULONG cLimit) { WNDGDI *WndObjInt = ObjToGDI(pwo, WND); ULONG Ret; DPRINT("WNDOBJ_cEnumStart: pwo = 0x%p, iType = %lu, iDirection = %lu, cLimit = %lu\n", pwo, iType, iDirection, cLimit); /* FIXME: Should we enumerate all rectangles or not? */ Ret = CLIPOBJ_cEnumStart(WndObjInt->ClientClipObj, FALSE, iType, iDirection, cLimit); DPRINT("WNDOBJ_cEnumStart: Returning 0x%lx\n", Ret); return Ret; }
/* * @implemented */ VOID APIENTRY EngDeleteWnd( IN WNDOBJ *pwo) { WNDGDI *WndObjInt = ObjToGDI(pwo, WND); PWND Window; BOOL calledFromUser; DPRINT("EngDeleteWnd: pwo = 0x%p\n", pwo); calledFromUser = UserIsEntered(); if (!calledFromUser){ UserEnterExclusive(); } /* Get window object */ Window = UserGetWindowObject(WndObjInt->Hwnd); if (Window == NULL) { DPRINT1("Warning: Couldnt get window object for WndObjInt->Hwnd!!!\n"); } else { /* Remove object from window */ IntRemoveProp(Window, AtomWndObj); --gcountPWO; } if (!calledFromUser){ UserLeave(); } /* Free resources */ IntEngDeleteClipRegion(WndObjInt->ClientClipObj); EngFreeMem(WndObjInt); }
/* * @implemented */ VOID APIENTRY EngDeleteClip(CLIPOBJ *ClipRegion) { EngFreeMem(ObjToGDI(ClipRegion, CLIP)); }
VOID FASTCALL IntEngDeleteClipRegion(CLIPOBJ *ClipObj) { EngFreeMem(ObjToGDI(ClipObj, CLIP)); }
return ClipGDI->EnumRects.c; } /* * @implemented */ BOOL APIENTRY CLIPOBJ_bEnum( _In_ CLIPOBJ *pco, _In_ ULONG cj, _Out_bytecap_(cj) ULONG *pulEnumRects) { RECTL *dest, *src; CLIPGDI *ClipGDI = ObjToGDI(pco, CLIP); ULONG nCopy, i; ENUMRECTS* pERects = (ENUMRECTS*)pulEnumRects; // Calculate how many rectangles we should copy nCopy = min( ClipGDI->EnumMax - ClipGDI->EnumPos, min( ClipGDI->EnumRects.c - ClipGDI->EnumPos, (cj - sizeof(ULONG)) / sizeof(RECTL))); if(nCopy == 0) { return FALSE; } /* Copy rectangles */ src = ClipGDI->EnumRects.arcl + ClipGDI->EnumPos;