ReactOS 0.4.15-dev-7704-gc07eb9f
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 */
10static
11inline
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
44static
45inline
48{
49 return INTERNAL_APPLY_MATRIX(&dc->pdcattr->mxWorldToDevice, points, count);
50}
51
52static
53inline
56{
57 return INTERNAL_APPLY_MATRIX(&dc->pdcattr->mxDeviceToWorld, points, count);
58}
59
61void
63 MATRIX *pmx,
64 const XFORML *pxform)
65{
66 XFORMOBJ xo;
67 XFORMOBJ_vInit(&xo, pmx);
68 XFORMOBJ_iSetXform(&xo, pxform);
69}
70
72void
74 XFORML *pxform,
75 const MATRIX *pmx)
76{
77 XFORMOBJ xo;
78 XFORMOBJ_vInit(&xo, (MATRIX*)pmx);
79 XFORMOBJ_iGetXform(&xo, pxform);
80}
81
83void
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
97VOID
100
101VOID
104
105VOID
108
110PSIZEL
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
129{
130 return &pdc->pdcattr->mxWorldToPage;
131}
132
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
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
161BOOL
162NTAPI
164 PDC pdc,
165 const XFORML *pXForm,
166 DWORD dwMode);
167
178
179static
180inline
183{
185 return INTERNAL_LPTODP(pdc, (LPPOINT)ppt, count);
186}
187#define CoordLPtoDP(pdc, ppt) INTERNAL_LPTODP(pdc, ppt, 1)
188
189static
190inline
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)
unsigned char BOOLEAN
BOOL FASTCALL GreDPtoLP(HDC, LPPOINT, INT)
Definition: dcutil.c:7
int APIENTRY IntGdiSetMapMode(PDC, int)
Definition: coord.c:828
FORCEINLINE void InvertXform(XFORML *pxformDest, const XFORML *pxformSource)
Definition: coord.h:84
FORCEINLINE PMATRIX DC_pmxDeviceToWorld(PDC pdc)
Definition: coord.h:149
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
FORCEINLINE void XFormToMatrix(MATRIX *pmx, const XFORML *pxform)
Definition: coord.h:62
VOID FASTCALL DC_vFixIsotropicMapping(PDC pdc)
Definition: coord.c:93
FORCEINLINE PMATRIX DC_pmxWorldToPage(PDC pdc)
Definition: coord.h:128
BOOL NTAPI GreModifyWorldTransform(PDC pdc, const XFORML *pXForm, DWORD dwMode)
Definition: coord.c:461
BOOL WINAPI GreSetDCOrg(_In_ HDC, _In_ LONG, _In_ LONG, _In_opt_ PRECTL)
Definition: coord.c:1357
VOID FASTCALL DC_vUpdateWorldToDevice(PDC pdc)
Definition: coord.c:182
BOOL WINAPI GreGetViewportExtEx(_In_ HDC hdc, _Out_ LPSIZE lpSize)
Definition: coord.c:1416
BOOL WINAPI GreGetDCOrgEx(_In_ HDC, _Out_ PPOINTL, _Out_ PRECTL)
Definition: coord.c:1386
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:135
VOID FASTCALL IntMirrorWindowOrg(PDC)
Definition: coord.c:1055
BOOL APIENTRY GreGetDCPoint(HDC, UINT, PPOINTL)
Definition: coord.c:1291
static BOOLEAN INTERNAL_APPLY_MATRIX(PMATRIX matrix, LPPOINT points, UINT count)
Definition: coord.h:13
BOOL FASTCALL GreSetViewportOrgEx(HDC, int, int, LPPOINT)
Definition: coord.c:915
BOOL FASTCALL GreLPtoDP(HDC, LPPOINT, INT)
Definition: dcutil.c:21
FORCEINLINE PSIZEL DC_pszlViewportExt(PDC pdc)
Definition: coord.h:111
static BOOLEAN IntDPtoLP(DC *pdc, PPOINTL ppt, UINT count)
Definition: coord.h:192
FORCEINLINE void MatrixToXForm(XFORML *pxform, const MATRIX *pmx)
Definition: coord.h:73
static BOOLEAN IntLPtoDP(DC *pdc, PPOINTL ppt, UINT count)
Definition: coord.h:182
VOID FASTCALL DC_vUpdateDeviceToWorld(PDC pdc)
Definition: coord.c:204
BOOL WINAPI GreGetWindowExtEx(_In_ HDC hdc, _Out_ LPSIZE lpSize)
Definition: coord.c:1407
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define APIENTRY
Definition: api.h:79
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FLOATOBJ_bConvertToLong(pf, pl)
Definition: floatobj.h:102
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLenum matrix
Definition: glext.h:9407
GLsizei const GLfloat * points
Definition: glext.h:8112
static const WCHAR dc[]
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
#define _In_opt_
Definition: ms_sal.h:309
unsigned int UINT
Definition: ndis.h:50
#define FASTCALL
Definition: nt_native.h:50
#define PAGE_EXTENTS_CHANGED
Definition: ntgdihdl.h:187
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:188
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:177
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:186
long LONG
Definition: pedump.c:60
Definition: polytest.cpp:41
Definition: matrix.h:44
SIZEL szlViewportExt
Definition: ntgdihdl.h:344
INT iMapMode
Definition: ntgdihdl.h:338
FLONG flXform
Definition: ntgdihdl.h:345
#define NTAPI
Definition: typedefs.h:36
int32_t INT
Definition: typedefs.h:58
#define FORCEINLINE
Definition: wdftypes.h:67
FLOAT FLOATOBJ
Definition: winddi.h:677
#define FLOATOBJ_Add(pf, pf1)
Definition: winddi.h:2818
#define FLOATOBJ_Mul(pf, pf1)
Definition: winddi.h:2824
#define FLOATOBJ_MulLong(pf, l)
Definition: winddi.h:2826
#define FLOATOBJ_SetLong(pf, l)
Definition: winddi.h:2815
#define WINAPI
Definition: msvc.h:6
#define MM_ISOTROPIC
Definition: wingdi.h:870
#define XFORMOBJ_iInverse
Definition: xformobj.h:17
#define XFORMOBJ_iSetXform
Definition: xformobj.h:14
#define XFORMOBJ_vInit
Definition: xformobj.h:12
#define XFORMOBJ_iGetXform
Definition: xformobj.h:9