ReactOS  0.4.15-dev-2993-g14fbe80
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 /*
8  * Applies matrix (which is made of FLOATOBJs) to the points array, which are made of integers.
9  */
10 static
11 inline
12 BOOLEAN
14 {
15  while (count--)
16  {
17  FLOATOBJ x, y;
18  FLOATOBJ tmp;
19 
20  /* x = x * matrix->efM11 + y * matrix->efM21 + matrix->efDx; */
22  FLOATOBJ_Mul(&x, &matrix->efM11);
23  tmp = matrix->efM21;
25  FLOATOBJ_Add(&x, &tmp);
26  FLOATOBJ_Add(&x, &matrix->efDx);
27 
28  /* y = x * matrix->efM12 + y * matrix->efM22 + matrix->efDy; */
30  FLOATOBJ_Mul(&y, &matrix->efM22);
31  tmp = matrix->efM12;
33  FLOATOBJ_Add(&y, &tmp);
34  FLOATOBJ_Add(&y, &matrix->efDy);
35 
37  return FALSE;
39  return FALSE;
40  }
41  return TRUE;
42 }
43 
44 static
45 inline
46 BOOLEAN
48 {
49  return INTERNAL_APPLY_MATRIX(&dc->pdcattr->mxWorldToDevice, points, count);
50 }
51 
52 static
53 inline
54 BOOLEAN
56 {
57  return INTERNAL_APPLY_MATRIX(&dc->pdcattr->mxDeviceToWorld, points, count);
58 }
59 
61 void
63  MATRIX *pmx,
64  const XFORML *pxform)
65 {
66  XFORMOBJ xo;
67  XFORMOBJ_vInit(&xo, pmx);
68  XFORMOBJ_iSetXform(&xo, pxform);
69 }
70 
72 void
74  XFORML *pxform,
75  const MATRIX *pmx)
76 {
77  XFORMOBJ xo;
78  XFORMOBJ_vInit(&xo, (MATRIX*)pmx);
79  XFORMOBJ_iGetXform(&xo, pxform);
80 }
81 
83 void
85  XFORML *pxformDest,
86  const XFORML *pxformSource)
87 {
88  XFORMOBJ xo;
89  MATRIX mx;
90 
91  XFORMOBJ_vInit(&xo, &mx);
92  XFORMOBJ_iSetXform(&xo, pxformSource);
93  XFORMOBJ_iInverse(&xo, &xo);
94  XFORMOBJ_iGetXform(&xo, pxformDest);
95 }
96 
97 VOID
100 
101 VOID
102 FASTCALL
104 
105 VOID
106 FASTCALL
108 
110 PSIZEL
112 {
113  PDC_ATTR pdcattr = pdc->pdcattr;
114 
115  /* Check if we need isotropic fixup */
116  if ((pdcattr->flXform & PAGE_EXTENTS_CHANGED) &&
117  (pdcattr->iMapMode == MM_ISOTROPIC))
118  {
119  /* Fixup viewport extension */
121  }
122 
123  return &pdcattr->szlViewportExt;
124 }
125 
127 PMATRIX
129 {
130  return &pdc->pdcattr->mxWorldToPage;
131 }
132 
134 PMATRIX
136 {
137  /* Check if world or page xform was changed */
138  if (pdc->pdcattr->flXform & (PAGE_XLATE_CHANGED|PAGE_EXTENTS_CHANGED|WORLD_XFORM_CHANGED))
139  {
140  /* Update the world-to-device xform */
142  }
143 
144  return &pdc->pdcattr->mxWorldToDevice;
145 }
146 
148 PMATRIX
150 {
151  /* Check if the device-to-world xform is invalid */
152  if (pdc->pdcattr->flXform & DEVICE_TO_WORLD_INVALID)
153  {
154  /* Update the world-to-device xform */
156  }
157 
158  return &pdc->pdcattr->mxDeviceToWorld;
159 }
160 
161 BOOL
162 NTAPI
164  PDC pdc,
165  const XFORML *pXForm,
166  DWORD dwMode);
167 
169 int APIENTRY IntGdiSetMapMode(PDC, int);
178 
179 static
180 inline
181 BOOLEAN
183 {
185  return INTERNAL_LPTODP(pdc, (LPPOINT)ppt, count);
186 }
187 #define CoordLPtoDP(pdc, ppt) INTERNAL_LPTODP(pdc, ppt, 1)
188 
189 static
190 inline
191 BOOLEAN
193 {
195  return INTERNAL_DPTOLP(pdc, (LPPOINT)ppt, count);
196 }
197 #define CoordDPtoLP(pdc, ppt) INTERNAL_DPTOLP(pdc, ppt, 1)
198 
199 #define XForm2MatrixS(m, x) XFormToMatrix(m, (XFORML*)x)
200 #define MatrixS2XForm(x, m) MatrixToXForm((XFORML*)x, m)
#define MM_ISOTROPIC
Definition: wingdi.h:869
FORCEINLINE void MatrixToXForm(XFORML *pxform, const MATRIX *pmx)
Definition: coord.h:73
#define _In_opt_
Definition: ms_sal.h:309
int APIENTRY IntGdiSetMapMode(PDC, int)
Definition: coord.c:828
#define XFORMOBJ_iInverse
Definition: xformobj.h:17
#define _Out_
Definition: ms_sal.h:345
#define TRUE
Definition: types.h:120
GLuint GLenum matrix
Definition: glext.h:9407
GLuint GLuint GLsizei count
Definition: gl.h:1545
INT iMapMode
Definition: ntgdihdl.h:342
static HDC
Definition: imagelist.c:92
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define XFORMOBJ_iSetXform
Definition: xformobj.h:14
FORCEINLINE void XFormToMatrix(MATRIX *pmx, const XFORML *pxform)
Definition: coord.h:62
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:58
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:201
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h: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
unsigned char BOOLEAN
#define _In_
Definition: ms_sal.h:308
#define FLOATOBJ_Add(pf, pf1)
Definition: winddi.h:2818
#define FLOATOBJ_bConvertToLong(pf, pl)
Definition: floatobj.h:102
BOOL WINAPI GreGetViewportExtEx(_In_ HDC hdc, _Out_ LPSIZE lpSize)
Definition: coord.c:1416
#define FLOATOBJ_MulLong(pf, l)
Definition: winddi.h:2826
BOOL WINAPI GreGetWindowExtEx(_In_ HDC hdc, _Out_ LPSIZE lpSize)
Definition: coord.c:1407
Definition: polytest.cpp:40
FLOAT FLOATOBJ
Definition: winddi.h:677
Definition: matrix.h:43
#define WINAPI
Definition: msvc.h:6
#define PAGE_EXTENTS_CHANGED
Definition: ntgdihdl.h:202
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei const GLfloat * points
Definition: glext.h:8112
HDC hdc
Definition: main.c:9
BOOL NTAPI GreModifyWorldTransform(PDC pdc, const XFORML *pXForm, DWORD dwMode)
Definition: coord.c:461
FLONG flXform
Definition: ntgdihdl.h:349
BOOL FASTCALL GreSetViewportOrgEx(HDC, int, int, LPPOINT)
Definition: coord.c:915
BOOL FASTCALL GreLPtoDP(HDC, LPPOINT, INT)
Definition: dcutil.c:21
static BOOLEAN IntDPtoLP(DC *pdc, PPOINTL ppt, UINT count)
Definition: coord.h:192
#define FLOATOBJ_SetLong(pf, l)
Definition: winddi.h:2815
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:203
BOOL APIENTRY GreGetDCPoint(HDC, UINT, PPOINTL)
Definition: coord.c:1291
BOOL WINAPI GreGetDCOrgEx(_In_ HDC, _Out_ PPOINTL, _Out_ PRECTL)
Definition: coord.c:1386
FORCEINLINE void InvertXform(XFORML *pxformDest, const XFORML *pxformSource)
Definition: coord.h:84
#define FORCEINLINE
Definition: wdftypes.h:67
unsigned int UINT
Definition: ndis.h:50
FORCEINLINE PSIZEL DC_pszlViewportExt(PDC pdc)
Definition: coord.h:111
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:192
FORCEINLINE PMATRIX DC_pmxWorldToPage(PDC pdc)
Definition: coord.h:128
SIZEL szlViewportExt
Definition: ntgdihdl.h:348
static const WCHAR dc[]
BOOL WINAPI GreSetDCOrg(_In_ HDC, _In_ LONG, _In_ LONG, _In_opt_ PRECTL)
Definition: coord.c:1357
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:135
FORCEINLINE PMATRIX DC_pmxDeviceToWorld(PDC pdc)
Definition: coord.h:149
VOID FASTCALL IntMirrorWindowOrg(PDC)
Definition: coord.c:1055
#define FLOATOBJ_Mul(pf, pf1)
Definition: winddi.h:2824
static BOOLEAN INTERNAL_DPTOLP(DC *dc, LPPOINT points, UINT count)
Definition: coord.h:55
static BOOLEAN INTERNAL_LPTODP(DC *dc, LPPOINT points, UINT count)
Definition: coord.h:47
VOID FASTCALL DC_vFixIsotropicMapping(PDC pdc)
Definition: coord.c:93
static BOOLEAN INTERNAL_APPLY_MATRIX(PMATRIX matrix, LPPOINT points, UINT count)
Definition: coord.h:13
#define APIENTRY
Definition: api.h:79
VOID FASTCALL DC_vUpdateDeviceToWorld(PDC pdc)
Definition: coord.c:204
static BOOLEAN IntLPtoDP(DC *pdc, PPOINTL ppt, UINT count)
Definition: coord.h:182