ReactOS  0.4.13-dev-563-g0561610
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) do { \
8  DC_vUpdateWorldToDevice(pdc); \
9  DC_vXformWorldToDevice(pdc, count, (PPOINTL)(ppt), (PPOINTL)(ppt)); \
10  } while (0)
11 #define CoordLPtoDP(pdc, ppt) \
12  DC_vXformWorldToDevice(pdc, 1, (PPOINTL)(ppt), (PPOINTL)(ppt));
13 #define IntDPtoLP(pdc, ppt, count) do { \
14  DC_vUpdateDeviceToWorld(pdc); \
15  DC_vXformDeviceToWorld(pdc, count, (PPOINTL)(ppt), (PPOINTL)(ppt)); \
16  } while (0)
17 #define CoordDPtoLP(pdc, ppt) \
18  DC_vXformDeviceToWorld(pdc, 1, (PPOINTL)(ppt), (PPOINTL)(ppt));
19 
20 #define XForm2MatrixS(m, x) XFormToMatrix(m, (XFORML*)x)
21 #define MatrixS2XForm(x, m) MatrixToXForm((XFORML*)x, m)
22 
24 void
26  MATRIX *pmx,
27  const XFORML *pxform)
28 {
29  XFORMOBJ xo;
30  XFORMOBJ_vInit(&xo, pmx);
31  XFORMOBJ_iSetXform(&xo, pxform);
32 }
33 
35 void
37  XFORML *pxform,
38  const MATRIX *pmx)
39 {
40  XFORMOBJ xo;
41  XFORMOBJ_vInit(&xo, (MATRIX*)pmx);
42  XFORMOBJ_iGetXform(&xo, pxform);
43 }
44 
46 void
48  XFORML *pxformDest,
49  const XFORML *pxformSource)
50 {
51  XFORMOBJ xo;
52  MATRIX mx;
53 
54  XFORMOBJ_vInit(&xo, &mx);
55  XFORMOBJ_iSetXform(&xo, pxformSource);
56  XFORMOBJ_iInverse(&xo, &xo);
57  XFORMOBJ_iGetXform(&xo, pxformDest);
58 }
59 
60 VOID
63 
64 VOID
67 
68 VOID
71 
73 PSIZEL
75 {
76  PDC_ATTR pdcattr = pdc->pdcattr;
77 
78  /* Check if we need isotropic fixup */
79  if ((pdcattr->flXform & PAGE_EXTENTS_CHANGED) &&
80  (pdcattr->iMapMode == MM_ISOTROPIC))
81  {
82  /* Fixup viewport extension */
84  }
85 
86  return &pdcattr->szlViewportExt;
87 }
88 
90 PMATRIX
92 {
93  return &pdc->pdcattr->mxWorldToPage;
94 }
95 
97 PMATRIX
99 {
100  /* Check if world or page xform was changed */
101  if (pdc->pdcattr->flXform & (PAGE_XLATE_CHANGED|PAGE_EXTENTS_CHANGED|WORLD_XFORM_CHANGED))
102  {
103  /* Update the world-to-device xform */
105  }
106 
107  return &pdc->pdcattr->mxWorldToDevice;
108 }
109 
111 PMATRIX
113 {
114  /* Check if the device-to-world xform is invalid */
115  if (pdc->pdcattr->flXform & DEVICE_TO_WORLD_INVALID)
116  {
117  /* Update the world-to-device xform */
119  }
120 
121  return &pdc->pdcattr->mxDeviceToWorld;
122 }
123 
125 VOID
127  IN PDC pdc,
128  IN ULONG cNumPoints,
129  OUT PPOINTL pptlDest,
130  IN PPOINTL pptlSource)
131 {
132  XFORMOBJ xo;
133  PMATRIX pmx;
134 
135  pmx = DC_pmxDeviceToWorld(pdc);
136  if (!MX_IsInvertible(pmx))
137  return;
138 
139  XFORMOBJ_vInit(&xo, pmx);
140  XFORMOBJ_bApplyXform(&xo, XF_LTOL, cNumPoints, pptlDest, pptlSource);
141 }
142 
144 VOID
146  IN PDC pdc,
147  IN ULONG cNumPoints,
148  OUT PPOINTL pptlDest,
149  IN PPOINTL pptlSource)
150 {
151  XFORMOBJ xo;
152  PMATRIX pmx;
153 
154  pmx = DC_pmxWorldToDevice(pdc);
155  XFORMOBJ_vInit(&xo, pmx);
156  XFORMOBJ_bApplyXform(&xo, XF_LTOL, cNumPoints, pptlDest, pptlSource);
157 }
158 
159 BOOL
160 NTAPI
162  PDC pdc,
163  const XFORML *pXForm,
164  DWORD dwMode);
165 
167 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:36
#define XFORMOBJ_bApplyXform
Definition: xformobj.h:11
int APIENTRY IntGdiSetMapMode(PDC, int)
Definition: coord.c:825
#define XFORMOBJ_iInverse
Definition: xformobj.h:17
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:25
FORCEINLINE VOID XFORMOBJ_vInit(OUT XFORMOBJ *pxo, IN MATRIX *pmx)
Definition: xformobj.h:21
#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:182
#define FORCEINLINE
Definition: ntbasedef.h:221
#define _Out_
Definition: no_sal2.h:323
FORCEINLINE VOID DC_vXformDeviceToWorld(IN PDC pdc, IN ULONG cNumPoints, OUT PPOINTL pptlDest, IN PPOINTL pptlSource)
Definition: coord.h:126
#define XF_LTOL
Definition: winddi.h:3109
BOOL WINAPI GreGetViewportExtEx(_In_ HDC hdc, _Out_ LPSIZE lpSize)
Definition: coord.c:1413
BOOL WINAPI GreGetWindowExtEx(_In_ HDC hdc, _Out_ LPSIZE lpSize)
Definition: coord.c:1404
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
BOOL FASTCALL MX_IsInvertible(IN PMATRIX pmx)
Definition: xformobj.c:267
HDC hdc
Definition: main.c:9
BOOL NTAPI GreModifyWorldTransform(PDC pdc, const XFORML *pXForm, DWORD dwMode)
Definition: coord.c:458
FLONG flXform
Definition: ntgdihdl.h:342
BOOL FASTCALL GreSetViewportOrgEx(HDC, int, int, LPPOINT)
Definition: coord.c:912
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:1288
BOOL WINAPI GreGetDCOrgEx(_In_ HDC, _Out_ PPOINTL, _Out_ PRECTL)
Definition: coord.c:1383
FORCEINLINE void InvertXform(XFORML *pxformDest, const XFORML *pxformSource)
Definition: coord.h:47
unsigned int UINT
Definition: ndis.h:50
FORCEINLINE PSIZEL DC_pszlViewportExt(PDC pdc)
Definition: coord.h:74
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:188
FORCEINLINE PMATRIX DC_pmxWorldToPage(PDC pdc)
Definition: coord.h:91
#define OUT
Definition: typedefs.h:39
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:1354
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:98
FORCEINLINE VOID DC_vXformWorldToDevice(IN PDC pdc, IN ULONG cNumPoints, OUT PPOINTL pptlDest, IN PPOINTL pptlSource)
Definition: coord.h:145
FORCEINLINE PMATRIX DC_pmxDeviceToWorld(PDC pdc)
Definition: coord.h:112
VOID FASTCALL IntMirrorWindowOrg(PDC)
Definition: coord.c:1052
VOID FASTCALL DC_vFixIsotropicMapping(PDC pdc)
Definition: coord.c:93
#define APIENTRY
Definition: api.h:79
VOID FASTCALL DC_vUpdateDeviceToWorld(PDC pdc)
Definition: coord.c:204