reactos/win32ss/gdi/ntgdi/coord.h
2013-06-16 22:01:41 +00:00

153 lines
3.1 KiB
C

#pragma once
#define IntLPtoDP(pdc, ppt, count) DC_vXformWorldToDevice(pdc, count, (PPOINTL)(ppt), (PPOINTL)(ppt));
#define CoordLPtoDP(pdc, ppt) DC_vXformWorldToDevice(pdc, 1, (PPOINTL)(ppt), (PPOINTL)(ppt));
#define IntDPtoLP(pdc, ppt, count) DC_vXformDeviceToWorld(pdc, count, (PPOINTL)(ppt), (PPOINTL)(ppt));
#define CoordDPtoLP(pdc, ppt) DC_vXformDeviceToWorld(pdc, 1, (PPOINTL)(ppt), (PPOINTL)(ppt));
#define XForm2MatrixS(m, x) XFormToMatrix(m, (XFORML*)x)
#define MatrixS2XForm(x, m) MatrixToXForm((XFORML*)x, m)
FORCEINLINE
void
XFormToMatrix(
MATRIX *pmx,
const XFORML *pxform)
{
XFORMOBJ xo;
XFORMOBJ_vInit(&xo, pmx);
XFORMOBJ_iSetXform(&xo, pxform);
}
FORCEINLINE
void
MatrixToXForm(
XFORML *pxform,
const MATRIX *pmx)
{
XFORMOBJ xo;
XFORMOBJ_vInit(&xo, (MATRIX*)pmx);
XFORMOBJ_iGetXform(&xo, pxform);
}
FORCEINLINE
void
InvertXform(
XFORML *pxformDest,
const XFORML *pxformSource)
{
XFORMOBJ xo;
MATRIX mx;
XFORMOBJ_vInit(&xo, &mx);
XFORMOBJ_iSetXform(&xo, pxformSource);
XFORMOBJ_iInverse(&xo, &xo);
XFORMOBJ_iGetXform(&xo, pxformDest);
}
VOID
FASTCALL
DC_vFixIsotropicMapping(PDC pdc);
VOID
FASTCALL
DC_vUpdateWorldToDevice(PDC pdc);
VOID
FASTCALL
DC_vUpdateDeviceToWorld(PDC pdc);
PSIZEL
FORCEINLINE
DC_pszlViewportExt(PDC pdc)
{
PDC_ATTR pdcattr = pdc->pdcattr;
/* Check if we need isotropic fixup */
if ((pdcattr->flXform & PAGE_EXTENTS_CHANGED) &&
(pdcattr->iMapMode == MM_ISOTROPIC))
{
/* Fixup viewport extension */
DC_vFixIsotropicMapping(pdc);
}
return &pdcattr->szlViewportExt;
}
PMATRIX
FORCEINLINE
DC_pmxWorldToPage(PDC pdc)
{
return &pdc->pdcattr->mxWorldToPage;
}
PMATRIX
FORCEINLINE
DC_pmxWorldToDevice(PDC pdc)
{
/* Check if world or page xform was changed */
if (pdc->pdcattr->flXform & (PAGE_XLATE_CHANGED|PAGE_EXTENTS_CHANGED|WORLD_XFORM_CHANGED))
{
/* Update the world-to-device xform */
DC_vUpdateWorldToDevice(pdc);
}
return &pdc->pdcattr->mxWorldToDevice;
}
PMATRIX
FORCEINLINE
DC_pmxDeviceToWorld(PDC pdc)
{
/* Check if the device-to-world xform is invalid */
if (pdc->pdcattr->flXform & DEVICE_TO_WORLD_INVALID)
{
/* Update the world-to-device xform */
DC_vUpdateDeviceToWorld(pdc);
}
return &pdc->pdcattr->mxDeviceToWorld;
}
VOID
FORCEINLINE
DC_vXformDeviceToWorld(
IN PDC pdc,
IN ULONG cNumPoints,
IN PPOINTL pptlDest,
IN PPOINTL pptlSource)
{
XFORMOBJ xo;
PMATRIX pmx;
pmx = DC_pmxDeviceToWorld(pdc);
XFORMOBJ_vInit(&xo, pmx);
XFORMOBJ_bApplyXform(&xo, XF_LTOL, cNumPoints, pptlDest, pptlSource);
}
VOID
FORCEINLINE
DC_vXformWorldToDevice(
IN PDC pdc,
IN ULONG cNumPoints,
IN PPOINTL pptlDest,
IN PPOINTL pptlSource)
{
XFORMOBJ xo;
PMATRIX pmx;
pmx = DC_pmxWorldToDevice(pdc);
XFORMOBJ_vInit(&xo, pmx);
XFORMOBJ_bApplyXform(&xo, XF_LTOL, cNumPoints, pptlDest, pptlSource);
}
BOOL
NTAPI
GreModifyWorldTransform(
PDC pdc,
const XFORML *pXForm,
DWORD dwMode);
VOID FASTCALL IntMirrorWindowOrg(PDC);
int APIENTRY IntGdiSetMapMode(PDC, int);