ReactOS 0.4.15-dev-7788-g1ad9096
coord.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MIN_COORD   (INT_MIN / 16)
 
#define MAX_COORD   (INT_MAX / 16)
 
#define CoordLPtoDP(pdc, ppt)   INTERNAL_LPTODP(pdc, ppt, 1)
 
#define CoordDPtoLP(pdc, ppt)   INTERNAL_DPTOLP(pdc, ppt, 1)
 
#define XForm2MatrixS(m, x)   XFormToMatrix(m, (XFORML*)x)
 
#define MatrixS2XForm(x, m)   MatrixToXForm((XFORML*)x, m)
 

Functions

static BOOLEAN INTERNAL_APPLY_MATRIX (PMATRIX matrix, LPPOINT points, UINT count)
 
static BOOLEAN INTERNAL_LPTODP (DC *dc, LPPOINT points, UINT count)
 
static BOOLEAN INTERNAL_DPTOLP (DC *dc, LPPOINT points, UINT count)
 
FORCEINLINE void XFormToMatrix (MATRIX *pmx, const XFORML *pxform)
 
FORCEINLINE void MatrixToXForm (XFORML *pxform, const MATRIX *pmx)
 
FORCEINLINE void InvertXform (XFORML *pxformDest, const XFORML *pxformSource)
 
VOID FASTCALL DC_vFixIsotropicMapping (PDC pdc)
 
VOID FASTCALL DC_vUpdateWorldToDevice (PDC pdc)
 
VOID FASTCALL DC_vUpdateDeviceToWorld (PDC pdc)
 
FORCEINLINE PSIZEL DC_pszlViewportExt (PDC pdc)
 
FORCEINLINE PMATRIX DC_pmxWorldToPage (PDC pdc)
 
FORCEINLINE PMATRIX DC_pmxWorldToDevice (PDC pdc)
 
FORCEINLINE PMATRIX DC_pmxDeviceToWorld (PDC pdc)
 
BOOL NTAPI GreModifyWorldTransform (PDC pdc, const XFORML *pXForm, DWORD dwMode)
 
VOID FASTCALL IntMirrorWindowOrg (PDC)
 
int APIENTRY IntGdiSetMapMode (PDC, int)
 
BOOL FASTCALL GreLPtoDP (HDC, LPPOINT, INT)
 
BOOL FASTCALL GreDPtoLP (HDC, LPPOINT, INT)
 
BOOL APIENTRY GreGetDCPoint (HDC, UINT, PPOINTL)
 
BOOL WINAPI GreGetWindowExtEx (_In_ HDC hdc, _Out_ LPSIZE lpSize)
 
BOOL WINAPI GreGetViewportExtEx (_In_ HDC hdc, _Out_ LPSIZE lpSize)
 
BOOL FASTCALL GreSetViewportOrgEx (HDC, int, int, LPPOINT)
 
BOOL WINAPI GreGetDCOrgEx (_In_ HDC, _Out_ PPOINTL, _Out_ PRECTL)
 
BOOL WINAPI GreSetDCOrg (_In_ HDC, _In_ LONG, _In_ LONG, _In_opt_ PRECTL)
 
static BOOLEAN IntLPtoDP (DC *pdc, PPOINTL ppt, UINT count)
 
static BOOLEAN IntDPtoLP (DC *pdc, PPOINTL ppt, UINT count)
 

Macro Definition Documentation

◆ CoordDPtoLP

#define CoordDPtoLP (   pdc,
  ppt 
)    INTERNAL_DPTOLP(pdc, ppt, 1)

Definition at line 197 of file coord.h.

◆ CoordLPtoDP

#define CoordLPtoDP (   pdc,
  ppt 
)    INTERNAL_LPTODP(pdc, ppt, 1)

Definition at line 187 of file coord.h.

◆ MatrixS2XForm

#define MatrixS2XForm (   x,
  m 
)    MatrixToXForm((XFORML*)x, m)

Definition at line 200 of file coord.h.

◆ MAX_COORD

#define MAX_COORD   (INT_MAX / 16)

Definition at line 5 of file coord.h.

◆ MIN_COORD

#define MIN_COORD   (INT_MIN / 16)

Definition at line 4 of file coord.h.

◆ XForm2MatrixS

#define XForm2MatrixS (   m,
  x 
)    XFormToMatrix(m, (XFORML*)x)

Definition at line 199 of file coord.h.

Function Documentation

◆ DC_pmxDeviceToWorld()

FORCEINLINE PMATRIX DC_pmxDeviceToWorld ( PDC  pdc)

Definition at line 149 of file coord.h.

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}
VOID FASTCALL DC_vUpdateDeviceToWorld(PDC pdc)
Definition: coord.c:204
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:177

Referenced by NtGdiGetTransform(), and NtGdiTransformPoints().

◆ DC_pmxWorldToDevice()

FORCEINLINE PMATRIX DC_pmxWorldToDevice ( PDC  pdc)

Definition at line 135 of file coord.h.

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}
VOID FASTCALL DC_vUpdateWorldToDevice(PDC pdc)
Definition: coord.c:182
#define PAGE_EXTENTS_CHANGED
Definition: ntgdihdl.h:187
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:188
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:186

Referenced by DC_vUpdateDeviceToWorld(), ftGdiGetGlyphOutline(), IntExtTextOutW(), NtGdiGetTransform(), NtGdiTransformPoints(), and REGION_LPTODP().

◆ DC_pmxWorldToPage()

FORCEINLINE PMATRIX DC_pmxWorldToPage ( PDC  pdc)

Definition at line 128 of file coord.h.

129{
130 return &pdc->pdcattr->mxWorldToPage;
131}

Referenced by NtGdiGetTransform().

◆ DC_pszlViewportExt()

FORCEINLINE PSIZEL DC_pszlViewportExt ( PDC  pdc)

Definition at line 111 of file coord.h.

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}
VOID FASTCALL DC_vFixIsotropicMapping(PDC pdc)
Definition: coord.c:93
SIZEL szlViewportExt
Definition: ntgdihdl.h:344
INT iMapMode
Definition: ntgdihdl.h:338
FLONG flXform
Definition: ntgdihdl.h:345
#define MM_ISOTROPIC
Definition: wingdi.h:870

Referenced by DC_vGetPageToDevice(), GreGetDCPoint(), NtGdiScaleViewportExtEx(), and PATH_StrokePath().

◆ DC_vFixIsotropicMapping()

VOID FASTCALL DC_vFixIsotropicMapping ( PDC  pdc)

Definition at line 93 of file coord.c.

94{
95 PDC_ATTR pdcattr;
96 LONG64 fx, fy;
97 LONG s;
98 SIZEL szlWindowExt, szlViewportExt;
99 ASSERT(pdc->pdcattr->iMapMode == MM_ISOTROPIC);
100
101 /* Get a pointer to the DC_ATTR */
102 pdcattr = pdc->pdcattr;
103
104 /* Read the extents, we rely on non-null values */
105 szlWindowExt = pdcattr->szlWindowExt;
106 szlViewportExt = pdcattr->szlViewportExt;
107
108 /* Check if all values are valid */
109 if ((szlWindowExt.cx == 0) || (szlWindowExt.cy == 0) ||
110 (szlViewportExt.cx == 0) || (szlViewportExt.cy == 0))
111 {
112 /* Someone put rubbish into the fields, just ignore it. */
113 return;
114 }
115
116 fx = abs((LONG64)szlWindowExt.cx * szlViewportExt.cy);
117 fy = abs((LONG64)szlWindowExt.cy * szlViewportExt.cx);
118
119 if (fx < fy)
120 {
121 s = (szlWindowExt.cy ^ szlViewportExt.cx) > 0 ? 1 : -1;
122 pdcattr->szlViewportExt.cx = (LONG)(fx * s / szlWindowExt.cy);
123 }
124 else if (fx > fy)
125 {
126 s = (szlWindowExt.cx ^ szlViewportExt.cy) > 0 ? 1 : -1;
127 pdcattr->szlViewportExt.cy = (LONG)(fy * s / szlWindowExt.cx);
128 }
129
130 /* Reset the flag */
131 pdc->pdcattr->flXform &= ~PAGE_EXTENTS_CHANGED;
132}
#define abs(i)
Definition: fconv.c:206
GLdouble s
Definition: gl.h:2039
#define ASSERT(a)
Definition: mode.c:44
long LONG
Definition: pedump.c:60
SIZEL szlWindowExt
Definition: ntgdihdl.h:342
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
GLfixed fx
Definition: tritemp.h:484
GLfixed fy
Definition: tritemp.h:490
int64_t LONG64
Definition: typedefs.h:68

Referenced by DC_pszlViewportExt(), and NtGdiScaleViewportExtEx().

◆ DC_vUpdateDeviceToWorld()

VOID FASTCALL DC_vUpdateDeviceToWorld ( PDC  pdc)

Definition at line 204 of file coord.c.

205{
206 XFORMOBJ xoWorldToDevice, xoDeviceToWorld;
207 PMATRIX pmxWorldToDevice;
208
209 /* Get the world-to-device translation */
210 pmxWorldToDevice = DC_pmxWorldToDevice(pdc);
211 XFORMOBJ_vInit(&xoWorldToDevice, pmxWorldToDevice);
212
213 /* Create inverse of world-to-device transformation */
214 XFORMOBJ_vInit(&xoDeviceToWorld, &pdc->pdcattr->mxDeviceToWorld);
215 if (XFORMOBJ_iInverse(&xoDeviceToWorld, &xoWorldToDevice) == DDI_ERROR)
216 {
217 MX_Set0(&pdc->pdcattr->mxDeviceToWorld);
218 return;
219 }
220
221 /* Reset the flag */
222 pdc->pdcattr->flXform &= ~DEVICE_TO_WORLD_INVALID;
223}
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:135
#define DDI_ERROR
Definition: winddi.h:154
VOID FASTCALL MX_Set0(OUT PMATRIX pmx)
Definition: xformobj.c:275
#define XFORMOBJ_iInverse
Definition: xformobj.h:17
#define XFORMOBJ_vInit
Definition: xformobj.h:12

Referenced by DC_pmxDeviceToWorld(), and IntDPtoLP().

◆ DC_vUpdateWorldToDevice()

VOID FASTCALL DC_vUpdateWorldToDevice ( PDC  pdc)

Definition at line 182 of file coord.c.

183{
184 XFORMOBJ xoPageToDevice, xoWorldToPage, xoWorldToDevice;
185 MATRIX mxPageToDevice;
186
187 // FIXME: make sure world-to-page is valid!
188
189 /* Construct a transformation to do the page-to-device conversion */
190 DC_vGetPageToDevice(pdc, &mxPageToDevice);
191 XFORMOBJ_vInit(&xoPageToDevice, &mxPageToDevice);
192
193 /* Recalculate the world-to-device xform */
194 XFORMOBJ_vInit(&xoWorldToPage, &pdc->pdcattr->mxWorldToPage);
195 XFORMOBJ_vInit(&xoWorldToDevice, &pdc->pdcattr->mxWorldToDevice);
196 XFORMOBJ_iCombine(&xoWorldToDevice, &xoWorldToPage, &xoPageToDevice);
197
198 /* Reset the flags */
199 pdc->pdcattr->flXform &= ~WORLD_XFORM_CHANGED;
200}
VOID FASTCALL DC_vGetPageToDevice(PDC pdc, MATRIX *pmx)
Definition: coord.c:136
Definition: matrix.h:44
#define XFORMOBJ_iCombine
Definition: xformobj.h:15

Referenced by DC_pmxWorldToDevice(), and IntLPtoDP().

◆ GreDPtoLP()

BOOL FASTCALL GreDPtoLP ( HDC  hdc,
LPPOINT  lpPoints,
INT  nCount 
)

Definition at line 7 of file dcutil.c.

8{
9 PDC dc;
10 if (!(dc = DC_LockDc(hdc)))
11 {
13 return FALSE;
14 }
15 IntDPtoLP(dc, lpPoints, nCount);
17 return TRUE;
18}
static BOOLEAN IntDPtoLP(DC *pdc, PPOINTL ppt, UINT count)
Definition: coord.h:192
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:238
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:220
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
static const WCHAR dc[]
HDC hdc
Definition: main.c:9
Definition: polytest.cpp:41
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22

Referenced by co_UserGetUpdateRect(), and IntDefWindowProc().

◆ GreGetDCOrgEx()

BOOL WINAPI GreGetDCOrgEx ( _In_  HDC,
_Out_  PPOINTL,
_Out_  PRECTL 
)

Definition at line 1386 of file coord.c.

1390{
1391 PDC dc;
1392
1393 dc = DC_LockDc(hdc);
1394 if (!dc) return FALSE;
1395
1396 /* Retrieve DC Window Rectangle without a check */
1397 *Rect = dc->erclWindow;
1398
1399 DC_UnlockDc(dc);
1400
1401 /* Use default call for DC Origin and parameter checking */
1403}
BOOL APIENTRY GreGetDCPoint(HDC hDC, UINT iPoint, PPOINTL Point)
Definition: coord.c:1291
@ GdiGetDCOrg
Definition: ntgdityp.h:80

◆ GreGetDCPoint()

BOOL APIENTRY GreGetDCPoint ( HDC  hDC,
UINT  iPoint,
PPOINTL  Point 
)

Definition at line 1291 of file coord.c.

1295{
1296 BOOL Ret = TRUE;
1297 DC *pdc;
1298 SIZE Size;
1299 PSIZEL pszlViewportExt;
1300
1301 if (!Point)
1302 {
1304 return FALSE;
1305 }
1306
1307 pdc = DC_LockDc(hDC);
1308 if (!pdc)
1309 {
1311 return FALSE;
1312 }
1313
1314 switch (iPoint)
1315 {
1316 case GdiGetViewPortExt:
1317 pszlViewportExt = DC_pszlViewportExt(pdc);
1318 Point->x = pszlViewportExt->cx;
1319 Point->y = pszlViewportExt->cy;
1320 break;
1321
1322 case GdiGetWindowExt:
1323 Point->x = pdc->pdcattr->szlWindowExt.cx;
1324 Point->y = pdc->pdcattr->szlWindowExt.cy;
1325 break;
1326
1327 case GdiGetViewPortOrg:
1328 *Point = pdc->pdcattr->ptlViewportOrg;
1329 break;
1330
1331 case GdiGetWindowOrg:
1332 *Point = pdc->pdcattr->ptlWindowOrg;
1333 break;
1334
1335 case GdiGetDCOrg:
1336 *Point = pdc->ptlDCOrig;
1337 break;
1338
1341 Point->x = Size.cx;
1342 Point->y = Size.cy;
1343 break;
1344
1345 default:
1347 Ret = FALSE;
1348 break;
1349 }
1350
1351 DC_UnlockDc(pdc);
1352 return Ret;
1353}
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE PSIZEL DC_pszlViewportExt(PDC pdc)
Definition: coord.h:111
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
unsigned int BOOL
Definition: ntddk_ex.h:94
static VOID FASTCALL DC_vGetAspectRatioFilter(PDC pDC, LPSIZE AspectRatio)
Definition: coord.c:1274
_In_ UINT iPoint
Definition: ntgdi.h:2197
@ GdiGetViewPortExt
Definition: ntgdityp.h:75
@ GdiGetAspectRatioFilter
Definition: ntgdityp.h:79
@ GdiGetWindowExt
Definition: ntgdityp.h:76
@ GdiGetViewPortOrg
Definition: ntgdityp.h:77
@ GdiGetWindowOrg
Definition: ntgdityp.h:78
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

Referenced by co_UserExcludeUpdateRgn(), GreGetDCOrgEx(), GreGetViewportExtEx(), GreGetWindowExtEx(), and NtGdiGetDCPoint().

◆ GreGetViewportExtEx()

BOOL WINAPI GreGetViewportExtEx ( _In_ HDC  hdc,
_Out_ LPSIZE  lpSize 
)

Definition at line 1416 of file coord.c.

1419{
1420 return GreGetDCPoint(hdc, GdiGetViewPortExt, (PPOINTL)lpSize);
1421}

Referenced by DrawTextExWorker().

◆ GreGetWindowExtEx()

BOOL WINAPI GreGetWindowExtEx ( _In_ HDC  hdc,
_Out_ LPSIZE  lpSize 
)

Definition at line 1407 of file coord.c.

1410{
1411 return GreGetDCPoint(hdc, GdiGetWindowExt, (PPOINTL)lpSize);
1412}

Referenced by DrawTextExWorker().

◆ GreLPtoDP()

BOOL FASTCALL GreLPtoDP ( HDC  hdc,
LPPOINT  lpPoints,
INT  nCount 
)

Definition at line 21 of file dcutil.c.

22{
23 PDC dc;
24 if (!(dc = DC_LockDc(hdc)))
25 {
27 return FALSE;
28 }
29 IntLPtoDP(dc, lpPoints, nCount);
31 return TRUE;
32}
static BOOLEAN IntLPtoDP(DC *pdc, PPOINTL ppt, UINT count)
Definition: coord.h:182

◆ GreModifyWorldTransform()

BOOL NTAPI GreModifyWorldTransform ( PDC  pdc,
const XFORML pXForm,
DWORD  dwMode 
)

Definition at line 461 of file coord.c.

465{
466 MATRIX mxSrc;
467 XFORMOBJ xoSrc, xoDC;
468
469 switch (dwMode)
470 {
471 case MWT_IDENTITY:
472 pdc->pdcattr->mxWorldToPage = gmxIdentity;
473 break;
474
475 case MWT_LEFTMULTIPLY:
476 XFORMOBJ_vInit(&xoDC, &pdc->pdcattr->mxWorldToPage);
477 XFORMOBJ_vInit(&xoSrc, &mxSrc);
478 if (XFORMOBJ_iSetXform(&xoSrc, pxform) == DDI_ERROR)
479 return FALSE;
480 XFORMOBJ_iCombine(&xoDC, &xoSrc, &xoDC);
481 break;
482
484 XFORMOBJ_vInit(&xoDC, &pdc->pdcattr->mxWorldToPage);
485 XFORMOBJ_vInit(&xoSrc, &mxSrc);
486 if (XFORMOBJ_iSetXform(&xoSrc, pxform) == DDI_ERROR)
487 return FALSE;
488 XFORMOBJ_iCombine(&xoDC, &xoDC, &xoSrc);
489 break;
490
491 case MWT_SET:
492 XFORMOBJ_vInit(&xoDC, &pdc->pdcattr->mxWorldToPage);
493 if (XFORMOBJ_iSetXform(&xoDC, pxform) == DDI_ERROR)
494 return FALSE;
495 break;
496
497 default:
498 return FALSE;
499 }
500
501 /*Set invalidation flags */
502 pdc->pdcattr->flXform |= WORLD_XFORM_CHANGED|DEVICE_TO_WORLD_INVALID;
503
504 return TRUE;
505}
const MATRIX gmxIdentity
Definition: coord.c:80
#define MWT_SET
Definition: ntgdityp.h:180
#define MWT_LEFTMULTIPLY
Definition: wingdi.h:945
#define MWT_RIGHTMULTIPLY
Definition: wingdi.h:946
#define MWT_IDENTITY
Definition: wingdi.h:944
#define XFORMOBJ_iSetXform
Definition: xformobj.h:14

Referenced by NtGdiModifyWorldTransform(), PATH_FillPathEx(), and PATH_StrokePath().

◆ GreSetDCOrg()

BOOL WINAPI GreSetDCOrg ( _In_  HDC,
_In_  LONG,
_In_  LONG,
_In_opt_  PRECTL 
)

Definition at line 1357 of file coord.c.

1362{
1363 PDC dc;
1364
1365 dc = DC_LockDc(hdc);
1366 if (!dc) return FALSE;
1367
1368 /* Set DC Origin */
1369 dc->ptlDCOrig.x = x;
1370 dc->ptlDCOrig.y = y;
1371
1372 /* Recalculate Fill Origin */
1373 dc->ptlFillOrigin.x = dc->dclevel.ptlBrushOrigin.x + x;
1374 dc->ptlFillOrigin.y = dc->dclevel.ptlBrushOrigin.y + y;
1375
1376 /* Set DC Window Rectangle */
1377 if (Rect)
1378 dc->erclWindow = *Rect;
1379
1380 DC_UnlockDc(dc);
1381 return TRUE;
1382}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by DceSetDrawable().

◆ GreSetViewportOrgEx()

BOOL FASTCALL GreSetViewportOrgEx ( HDC  hDC,
int  X,
int  Y,
LPPOINT  Point 
)

Definition at line 915 of file coord.c.

920{
921 PDC dc;
922 PDC_ATTR pdcattr;
923
924 dc = DC_LockDc(hDC);
925 if (!dc)
926 {
928 return FALSE;
929 }
930 pdcattr = dc->pdcattr;
931
932 if (Point)
933 {
934 Point->x = pdcattr->ptlViewportOrg.x;
935 Point->y = pdcattr->ptlViewportOrg.y;
936 }
937
938 pdcattr->ptlViewportOrg.x = X;
939 pdcattr->ptlViewportOrg.y = Y;
941
943 return TRUE;
944}
#define Y(I)
#define X(b, s)
POINTL ptlViewportOrg
Definition: ntgdihdl.h:343
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329

Referenced by MENU_DrawBitmapItem().

◆ IntDPtoLP()

static BOOLEAN IntDPtoLP ( DC pdc,
PPOINTL  ppt,
UINT  count 
)
inlinestatic

Definition at line 192 of file coord.h.

193{
195 return INTERNAL_DPTOLP(pdc, (LPPOINT)ppt, count);
196}
static BOOLEAN INTERNAL_DPTOLP(DC *dc, LPPOINT points, UINT count)
Definition: coord.h:55
GLuint GLuint GLsizei count
Definition: gl.h:1545

Referenced by GreDPtoLP(), IntGdiMoveToEx(), NtGdiGetBoundsRect(), and PATH_StrokePath().

◆ INTERNAL_APPLY_MATRIX()

static BOOLEAN INTERNAL_APPLY_MATRIX ( PMATRIX  matrix,
LPPOINT  points,
UINT  count 
)
inlinestatic

Definition at line 13 of file coord.h.

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}
#define FLOATOBJ_bConvertToLong(pf, pl)
Definition: floatobj.h:102
GLuint GLenum matrix
Definition: glext.h:9407
GLsizei const GLfloat * points
Definition: glext.h:8112
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

Referenced by INTERNAL_DPTOLP(), INTERNAL_LPTODP(), and NtGdiTransformPoints().

◆ INTERNAL_DPTOLP()

static BOOLEAN INTERNAL_DPTOLP ( DC dc,
LPPOINT  points,
UINT  count 
)
inlinestatic

Definition at line 55 of file coord.h.

56{
57 return INTERNAL_APPLY_MATRIX(&dc->pdcattr->mxDeviceToWorld, points, count);
58}
static BOOLEAN INTERNAL_APPLY_MATRIX(PMATRIX matrix, LPPOINT points, UINT count)
Definition: coord.h:13

Referenced by IntDPtoLP().

◆ INTERNAL_LPTODP()

static BOOLEAN INTERNAL_LPTODP ( DC dc,
LPPOINT  points,
UINT  count 
)
inlinestatic

Definition at line 47 of file coord.h.

48{
49 return INTERNAL_APPLY_MATRIX(&dc->pdcattr->mxWorldToDevice, points, count);
50}

Referenced by IntLPtoDP(), and PATH_Arc().

◆ IntGdiSetMapMode()

int APIENTRY IntGdiSetMapMode ( PDC  dc,
int  MapMode 
)

Definition at line 828 of file coord.c.

831{
832 INT iPrevMapMode;
833 FLONG flXform;
834 PDC_ATTR pdcattr = dc->pdcattr;
835
836 if (MapMode == pdcattr->iMapMode)
837 return MapMode;
838
842
843 switch (MapMode)
844 {
845 case MM_TEXT:
846 pdcattr->szlWindowExt.cx = 1;
847 pdcattr->szlWindowExt.cy = 1;
848 pdcattr->szlViewportExt.cx = 1;
849 pdcattr->szlViewportExt.cy = 1;
851 break;
852
853 case MM_ISOTROPIC:
854 flXform |= ISO_OR_ANISO_MAP_MODE;
855 /* Fall through */
856
857 case MM_LOMETRIC:
858 pdcattr->szlWindowExt.cx = pdcattr->szlVirtualDeviceMm.cx * 10;
859 pdcattr->szlWindowExt.cy = pdcattr->szlVirtualDeviceMm.cy * 10;
860 pdcattr->szlViewportExt.cx = pdcattr->szlVirtualDevicePixel.cx;
861 pdcattr->szlViewportExt.cy = -pdcattr->szlVirtualDevicePixel.cy;
862 break;
863
864 case MM_HIMETRIC:
865 pdcattr->szlWindowExt.cx = pdcattr->szlVirtualDeviceMm.cx * 100;
866 pdcattr->szlWindowExt.cy = pdcattr->szlVirtualDeviceMm.cy * 100;
867 pdcattr->szlViewportExt.cx = pdcattr->szlVirtualDevicePixel.cx;
868 pdcattr->szlViewportExt.cy = -pdcattr->szlVirtualDevicePixel.cy;
869 break;
870
871 case MM_LOENGLISH:
872 pdcattr->szlWindowExt.cx = EngMulDiv(1000, pdcattr->szlVirtualDeviceMm.cx, 254);
873 pdcattr->szlWindowExt.cy = EngMulDiv(1000, pdcattr->szlVirtualDeviceMm.cy, 254);
874 pdcattr->szlViewportExt.cx = pdcattr->szlVirtualDevicePixel.cx;
875 pdcattr->szlViewportExt.cy = -pdcattr->szlVirtualDevicePixel.cy;
876 break;
877
878 case MM_HIENGLISH:
879 pdcattr->szlWindowExt.cx = EngMulDiv(10000, pdcattr->szlVirtualDeviceMm.cx, 254);
880 pdcattr->szlWindowExt.cy = EngMulDiv(10000, pdcattr->szlVirtualDeviceMm.cy, 254);
881 pdcattr->szlViewportExt.cx = pdcattr->szlVirtualDevicePixel.cx;
882 pdcattr->szlViewportExt.cy = -pdcattr->szlVirtualDevicePixel.cy;
883 break;
884
885 case MM_TWIPS:
886 pdcattr->szlWindowExt.cx = EngMulDiv(14400, pdcattr->szlVirtualDeviceMm.cx, 254);
887 pdcattr->szlWindowExt.cy = EngMulDiv(14400, pdcattr->szlVirtualDeviceMm.cy, 254);
888 pdcattr->szlViewportExt.cx = pdcattr->szlVirtualDevicePixel.cx;
889 pdcattr->szlViewportExt.cy = -pdcattr->szlVirtualDevicePixel.cy;
890 break;
891
892 case MM_ANISOTROPIC:
894 flXform |= ISO_OR_ANISO_MAP_MODE;
895 break;
896
897 default:
898 return 0;
899 }
900
901 /* Save the old map mode and set the new one */
902 iPrevMapMode = pdcattr->iMapMode;
903 pdcattr->iMapMode = MapMode;
904
905 /* Update xform flags */
906 pdcattr->flXform = flXform | (PAGE_XLATE_CHANGED | PAGE_EXTENTS_CHANGED |
909
910 return iPrevMapMode;
911}
unsigned long FLONG
Definition: ntbasedef.h:366
#define PAGE_TO_DEVICE_SCALE_IDENTITY
Definition: ntgdihdl.h:185
#define PTOD_EFM22_NEGATIVE
Definition: ntgdihdl.h:182
#define POSITIVE_Y_IS_UP
Definition: ntgdihdl.h:179
#define DEVICE_TO_PAGE_INVALID
Definition: ntgdihdl.h:176
#define PTOD_EFM11_NEGATIVE
Definition: ntgdihdl.h:181
#define INVALIDATE_ATTRIBUTES
Definition: ntgdihdl.h:180
#define ISO_OR_ANISO_MAP_MODE
Definition: ntgdihdl.h:183
#define PAGE_TO_DEVICE_IDENTITY
Definition: ntgdihdl.h:184
SIZEL szlVirtualDevicePixel
Definition: ntgdihdl.h:346
SIZEL szlVirtualDeviceMm
Definition: ntgdihdl.h:347
int32_t INT
Definition: typedefs.h:58
ENGAPI INT APIENTRY EngMulDiv(_In_ INT a, _In_ INT b, _In_ INT c)
Definition: math.c:26
#define MM_HIENGLISH
Definition: wingdi.h:868
#define MM_LOENGLISH
Definition: wingdi.h:871
#define MM_HIMETRIC
Definition: wingdi.h:869
#define MM_ANISOTROPIC
Definition: wingdi.h:867
#define MM_TWIPS
Definition: wingdi.h:874
#define MM_LOMETRIC
Definition: wingdi.h:872
#define MM_TEXT
Definition: wingdi.h:873

Referenced by _Success_(), and PATH_FillPathEx().

◆ IntLPtoDP()

◆ IntMirrorWindowOrg()

VOID FASTCALL IntMirrorWindowOrg ( PDC  dc)

Definition at line 1055 of file coord.c.

1056{
1057 PDC_ATTR pdcattr;
1058 LONG X, cx;
1059
1060 pdcattr = dc->pdcattr;
1061
1062 if (!(pdcattr->dwLayout & LAYOUT_RTL))
1063 {
1064 pdcattr->ptlWindowOrg.x = pdcattr->lWindowOrgx; // Flip it back.
1065 return;
1066 }
1067
1068 /* Copy the window extension, so no one can mess with it */
1069 cx = pdcattr->szlViewportExt.cx;
1070 if (cx == 0) return;
1071 //
1072 // WOrgx = wox - (Width - 1) * WExtx / VExtx
1073 //
1074 X = (dc->erclWindow.right - dc->erclWindow.left) - 1; // Get device width - 1
1075
1076 X = (X * pdcattr->szlWindowExt.cx) / cx;
1077
1078 pdcattr->ptlWindowOrg.x = pdcattr->lWindowOrgx - X; // Now set the inverted win origion.
1080
1081 return;
1082}
_Out_opt_ int * cx
Definition: commctrl.h:585
LONG lWindowOrgx
Definition: ntgdihdl.h:340
DWORD dwLayout
Definition: ntgdihdl.h:339
POINTL ptlWindowOrg
Definition: ntgdihdl.h:341
#define LAYOUT_RTL
Definition: wingdi.h:1371

Referenced by NtGdiMirrorWindowOrg(), NtGdiScaleViewportExtEx(), and NtGdiScaleWindowExtEx().

◆ InvertXform()

FORCEINLINE void InvertXform ( XFORML pxformDest,
const XFORML pxformSource 
)

Definition at line 84 of file coord.h.

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}
#define XFORMOBJ_iGetXform
Definition: xformobj.h:9

◆ MatrixToXForm()

FORCEINLINE void MatrixToXForm ( XFORML pxform,
const MATRIX pmx 
)

Definition at line 73 of file coord.h.

76{
77 XFORMOBJ xo;
78 XFORMOBJ_vInit(&xo, (MATRIX*)pmx);
79 XFORMOBJ_iGetXform(&xo, pxform);
80}

◆ XFormToMatrix()

FORCEINLINE void XFormToMatrix ( MATRIX pmx,
const XFORML pxform 
)

Definition at line 62 of file coord.h.

65{
66 XFORMOBJ xo;
67 XFORMOBJ_vInit(&xo, pmx);
68 XFORMOBJ_iSetXform(&xo, pxform);
69}