ReactOS  0.4.13-dev-66-gc714b7f
coord.h
Go to the documentation of this file.
1 #pragma once
2 
3 /* Maximum extend of coordinate space */
4 #define MIN_COORD (INT_MIN / 16)
5 #define MAX_COORD (INT_MAX / 16)
6 
7 #define IntLPtoDP(pdc, ppt, count) \
8  DC_vUpdateWorldToDevice(pdc); \
9  DC_vXformWorldToDevice(pdc, count, (PPOINTL)(ppt), (PPOINTL)(ppt));
10 #define CoordLPtoDP(pdc, ppt) \
11  DC_vXformWorldToDevice(pdc, 1, (PPOINTL)(ppt), (PPOINTL)(ppt));
12 #define IntDPtoLP(pdc, ppt, count) \
13  DC_vUpdateDeviceToWorld(pdc); \
14  DC_vXformDeviceToWorld(pdc, count, (PPOINTL)(ppt), (PPOINTL)(ppt));
15 #define CoordDPtoLP(pdc, ppt) \
16  DC_vXformDeviceToWorld(pdc, 1, (PPOINTL)(ppt), (PPOINTL)(ppt));
17 
18 #define XForm2MatrixS(m, x) XFormToMatrix(m, (XFORML*)x)
19 #define MatrixS2XForm(x, m) MatrixToXForm((XFORML*)x, m)
20 
22 void
24  MATRIX *pmx,
25  const XFORML *pxform)
26 {
27  XFORMOBJ xo;
28  XFORMOBJ_vInit(&xo, pmx);
29  XFORMOBJ_iSetXform(&xo, pxform);
30 }
31 
33 void
35  XFORML *pxform,
36  const MATRIX *pmx)
37 {
38  XFORMOBJ xo;
39  XFORMOBJ_vInit(&xo, (MATRIX*)pmx);
40  XFORMOBJ_iGetXform(&xo, pxform);
41 }
42 
44 void
46  XFORML *pxformDest,
47  const XFORML *pxformSource)
48 {
49  XFORMOBJ xo;
50  MATRIX mx;
51 
52  XFORMOBJ_vInit(&xo, &mx);
53  XFORMOBJ_iSetXform(&xo, pxformSource);
54  XFORMOBJ_iInverse(&xo, &xo);
55  XFORMOBJ_iGetXform(&xo, pxformDest);
56 }
57 
58 VOID
61 
62 VOID
65 
66 VOID
69 
71 PSIZEL
73 {
74  PDC_ATTR pdcattr = pdc->pdcattr;
75 
76  /* Check if we need isotropic fixup */
77  if ((pdcattr->flXform & PAGE_EXTENTS_CHANGED) &&
78  (pdcattr->iMapMode == MM_ISOTROPIC))
79  {
80  /* Fixup viewport extension */
82  }
83 
84  return &pdcattr->szlViewportExt;
85 }
86 
88 PMATRIX
90 {
91  return &pdc->pdcattr->mxWorldToPage;
92 }
93 
95 PMATRIX
97 {
98  /* Check if world or page xform was changed */
99  if (pdc->pdcattr->flXform & (PAGE_XLATE_CHANGED|PAGE_EXTENTS_CHANGED|WORLD_XFORM_CHANGED))
100  {
101  /* Update the world-to-device xform */
103  }
104 
105  return &pdc->pdcattr->mxWorldToDevice;
106 }
107 
109 PMATRIX
111 {
112  /* Check if the device-to-world xform is invalid */
113  if (pdc->pdcattr->flXform & DEVICE_TO_WORLD_INVALID)
114  {
115  /* Update the world-to-device xform */
117  }
118 
119  return &pdc->pdcattr->mxDeviceToWorld;
120 }
121 
123 VOID
125  IN PDC pdc,
126  IN ULONG cNumPoints,
127  IN PPOINTL pptlDest,
128  IN PPOINTL pptlSource)
129 {
130  XFORMOBJ xo;
131  PMATRIX pmx;
132 
133  pmx = DC_pmxDeviceToWorld(pdc);
134  XFORMOBJ_vInit(&xo, pmx);
135  XFORMOBJ_bApplyXform(&xo, XF_LTOL, cNumPoints, pptlDest, pptlSource);
136 }
137 
139 VOID
141  IN PDC pdc,
142  IN ULONG cNumPoints,
143  IN PPOINTL pptlDest,
144  IN PPOINTL pptlSource)
145 {
146  XFORMOBJ xo;
147  PMATRIX pmx;
148 
149  pmx = DC_pmxWorldToDevice(pdc);
150  XFORMOBJ_vInit(&xo, pmx);
151  XFORMOBJ_bApplyXform(&xo, XF_LTOL, cNumPoints, pptlDest, pptlSource);
152 }
153 
154 BOOL
155 NTAPI
157  PDC pdc,
158  const XFORML *pXForm,
159  DWORD dwMode);
160 
162 int APIENTRY IntGdiSetMapMode(PDC, int);
#define MM_ISOTROPIC
Definition: wingdi.h:869
#define IN
Definition: typedefs.h:38
FORCEINLINE void MatrixToXForm(XFORML *pxform, const MATRIX *pmx)
Definition: coord.h:34
#define XFORMOBJ_bApplyXform
Definition: xformobj.h:11
int APIENTRY IntGdiSetMapMode(PDC, int)
Definition: coord.c:816
#define XFORMOBJ_iInverse
Definition: xformobj.h:17
FORCEINLINE VOID DC_vXformWorldToDevice(IN PDC pdc, IN ULONG cNumPoints, IN PPOINTL pptlDest, IN PPOINTL pptlSource)
Definition: coord.h:140
INT iMapMode
Definition: ntgdihdl.h:335
static HDC
Definition: imagelist.c:92
#define XFORMOBJ_iSetXform
Definition: xformobj.h:14
FORCEINLINE void XFormToMatrix(MATRIX *pmx, const XFORML *pxform)
Definition: coord.h:23
FORCEINLINE VOID XFORMOBJ_vInit(OUT XFORMOBJ *pxo, IN MATRIX *pmx)
Definition: xformobj.h:21
FORCEINLINE VOID DC_vXformDeviceToWorld(IN PDC pdc, IN ULONG cNumPoints, IN PPOINTL pptlDest, IN PPOINTL pptlSource)
Definition: coord.h:124
#define FASTCALL
Definition: nt_native.h:50
int32_t INT
Definition: typedefs.h:56
#define _In_opt_
Definition: no_sal2.h:213
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:197
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define XFORMOBJ_iGetXform
Definition: xformobj.h:9
long LONG
Definition: pedump.c:60
BOOL FASTCALL GreDPtoLP(HDC, LPPOINT, INT)
Definition: dcutil.c:7
VOID FASTCALL DC_vUpdateWorldToDevice(PDC pdc)
Definition: coord.c:181
#define FORCEINLINE
Definition: ntbasedef.h:221
#define _Out_
Definition: no_sal2.h:323
#define XF_LTOL
Definition: winddi.h:3109
BOOL WINAPI GreGetViewportExtEx(_In_ HDC hdc, _Out_ LPSIZE lpSize)
Definition: coord.c:1399
BOOL WINAPI GreGetWindowExtEx(_In_ HDC hdc, _Out_ LPSIZE lpSize)
Definition: coord.c:1390
Definition: polytest.cpp:40
Definition: matrix.h:43
#define WINAPI
Definition: msvc.h:8
#define PAGE_EXTENTS_CHANGED
Definition: ntgdihdl.h:198
unsigned long DWORD
Definition: ntddk_ex.h:95
HDC hdc
Definition: main.c:9
BOOL NTAPI GreModifyWorldTransform(PDC pdc, const XFORML *pXForm, DWORD dwMode)
Definition: coord.c:453
FLONG flXform
Definition: ntgdihdl.h:342
BOOL FASTCALL GreSetViewportOrgEx(HDC, int, int, LPPOINT)
Definition: coord.c:899
BOOL FASTCALL GreLPtoDP(HDC, LPPOINT, INT)
Definition: dcutil.c:21
#define _In_
Definition: no_sal2.h:204
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:199
BOOL APIENTRY GreGetDCPoint(HDC, UINT, PPOINTL)
Definition: coord.c:1274
BOOL WINAPI GreGetDCOrgEx(_In_ HDC, _Out_ PPOINTL, _Out_ PRECTL)
Definition: coord.c:1369
FORCEINLINE void InvertXform(XFORML *pxformDest, const XFORML *pxformSource)
Definition: coord.h:45
unsigned int UINT
Definition: ndis.h:50
FORCEINLINE PSIZEL DC_pszlViewportExt(PDC pdc)
Definition: coord.h:72
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:188
FORCEINLINE PMATRIX DC_pmxWorldToPage(PDC pdc)
Definition: coord.h:89
SIZEL szlViewportExt
Definition: ntgdihdl.h:341
unsigned int ULONG
Definition: retypes.h:1
BOOL WINAPI GreSetDCOrg(_In_ HDC, _In_ LONG, _In_ LONG, _In_opt_ PRECTL)
Definition: coord.c:1340
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:96
FORCEINLINE PMATRIX DC_pmxDeviceToWorld(PDC pdc)
Definition: coord.h:110
VOID FASTCALL IntMirrorWindowOrg(PDC)
Definition: coord.c:1039
VOID FASTCALL DC_vFixIsotropicMapping(PDC pdc)
Definition: coord.c:92
#define APIENTRY
Definition: api.h:79
VOID FASTCALL DC_vUpdateDeviceToWorld(PDC pdc)
Definition: coord.c:203